Re: convert Uint32 to System.drawing.color
- From: Göran Andersson <guffa@xxxxxxxxx>
- Date: Thu, 22 Feb 2007 11:56:41 +0100
Yaniv wrote:
Göran Andersson כתב:Yaniv wrote:HiIf the integer is representing an argb (alpha+rgb) value, then you can
How can I convert Uint32 variable to System.drawing.color ??
Thanks in advanced
Yaniv
use the Color.FromArgb(int) method. If it only represents an rgb value,
then you can use Color.FromArgb(int, int), where the first integer is
the alpha value, which you should set to 255 to get a solid color.
--
Göran Andersson
_____
http://www.guffa.com
Hi
The first option you wrote is not working since the value is Uint32
and not integer as you wrote (I'v got the message "Value of type
'System.UInt32' cannot be converted to 'Integer')
You can just cast the UInt32 to an Int32:
Color color = Color.FromArgb((int)colorValue);
The second option doesn't exist in VB.NET at all (Anyway I can't
convert Uint32 to int.....)
Yes, you are right. There is no such overload to the method. I was thinking of the Color.FromArgb(int, Color) overload:
Color color = Color.FromArgb(255, Color.FromArgb((int)colorValue));
actually I dont know if the Uint32 color is represent argb color or
only rgb color...
That will be obvious when you try to use it. If it's an rgb value the top eight bits will be zero, which when used as alpha will make a completely transparent color.
--
Göran Andersson
_____
http://www.guffa.com
.
- Follow-Ups:
- Re: convert Uint32 to System.drawing.color
- From: Göran Andersson
- Re: convert Uint32 to System.drawing.color
- References:
- convert Uint32 to System.drawing.color
- From: Yaniv
- Re: convert Uint32 to System.drawing.color
- From: Göran Andersson
- Re: convert Uint32 to System.drawing.color
- From: Yaniv
- convert Uint32 to System.drawing.color
- Prev by Date: Re: Radio Buttons question
- Next by Date: Re: convert Uint32 to System.drawing.color
- Previous by thread: Re: convert Uint32 to System.drawing.color
- Next by thread: Re: convert Uint32 to System.drawing.color
- Index(es):
Relevant Pages
|