Community discussion forum

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

  • 5 months 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.

    Post was edited on 26/05/2009 11:00:28 Report abuse
  • 4 months 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).

Want to stay in touch with what's going on? Follow us on twitter!