|
-
Sep 17th, 2002, 12:07 AM
#1
Thread Starter
I wonder how many charact
Convert (Vb6 style) long rgb value to something useful in vb.net
Really, this should be simple...
In VB6, you could represent colors using a long data type for the 64,000+ possible colors.....
So if I have a data item (myMapLine(i).Colour) that holds a line's color using a long between 0 and 64,000, how the heck do I assign that in VB.net?
VB Code:
myPen = New Pen(Color.FromArgb(myMapLine(i).colour), myMapLine(i).thickness)
That doesn't work... nothing appears at all....
-
Sep 17th, 2002, 07:46 AM
#2
Hyperactive Member
Try making the RGB value negative,
ie
VB Code:
dim intColor as int32
intColor = myMapLine(i).Colour * -1
myPen = New Pen(Color.FromArgb(intColor), myMapLine(i).thickness)
-
Sep 17th, 2002, 08:22 AM
#3
Re: Convert (Vb6 style) long rgb value to something useful in vb.net
Originally posted by nemaroller
VB Code:
myPen = New Pen(Color.FromArgb(myMapLine(i).colour), myMapLine(i).thickness)
That doesn't work... nothing appears at all....
I struggled with this as well. The problem is the difference between RGB and ARGB, where a is the alpha blending part. Because this is 0 in RGB, the color is completely transparent, so in fact it is invisible.
Try something like this:
VB Code:
myPen = New Pen(Color.FromArgb(myMapLine(i).colour OR &HFF000000), myMapLine(i).thickness)
-
Sep 17th, 2002, 09:11 AM
#4
Thread Starter
I wonder how many charact
Thanks for the replies, at least something is drawing on the screen now, the first solution appears closer to the colors that resulted from the vb6 version, but they seem washed...
The second solution changed the basic hue from red/orange to bluish....
Last edited by nemaroller; Sep 17th, 2002 at 10:17 AM.
-
Sep 17th, 2002, 09:56 AM
#5
You could try if the ColorTranslator.FromOle yields better results.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|