In VB.NET there's 3 types of color data types(System.Drawing.Color, System.Drawing.Pens and System.Drawing.Brushes) depending on what you'll use it for. Is there anyway for me to convert a color between this three. For example if I have a give color as the color datatype, is it then possible for me to create a brush and a pen from it?
This problem has bothered me for a long time so I would be glad to get some help
Thanks /Vswe :)
System.Drawing.Color, System.Drawing.Pens and System.Drawing.Brushes
Started by Vswe, Nov 13 2009 04:33 PM
1 reply to this topic
#1
Posted 13 November 2009 - 04:33 PM
|
|
|
#2
Posted 18 May 2010 - 02:30 AM
Since no one have answered this I will now answer this for anyone else having the same trouble.
Dim myColor As Color
Dim myBrush As Brush
Dim myPen As Pen
'From Color to brush/pen
myBrush = New SolidBrush(myColor)
myPen = New Pen(myColor)
'From Brush to color/pen
myPen = New Pen(myBrush)
myColor = New Pen(myBrush).Color
'From Pen to color/brush
myColor = myPen.Color
myBrush = New SolidBrush(myPen.Color)


Sign In
Create Account


Back to top









