Unable to cast object of type 'System.Drawing.Drawing2D.LinearGradientBrush' to type 'System.Windows.Media.LinearGradientBrush'.

dotnet3.5 , wpf , csharp India
  • 11 years ago

    Hello, Please i am trying to develop a program in which i am getting the "System.Drawing.Drawing2D.LinearGradientBrush" object. this object i have to set on the WPF appication "System.Windows.Media.LinearGradientBrush" object.

    Hope this information is helpful. Is there any way to convert this.??

    Thanks.

  • 11 years ago

    I would try writing my own conversion code if you can't copy it. For example:

    Function ConvertBrush (BrushType) as Media.LinearGradientBrush

    New LGB as Media.LinearGradientBrush(...assign each property from the BrushType being passed in)

    Return LGB

    End Function

    Hope this helps some. If I was home programming I would work on this to see it in further detail but in my head this idea works. Give it a shot or maybe it will take you in the right direction.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry