471,337 Members | 925 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Create Image or Bitmap from ARGB value

Hi all

I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by
using the Color.ToArgb method), is there any way that I can create a
System.Drawing.Image or a System.Drawing.Bitmap from that value?

Regards,
Steve
Jul 21 '05 #1
5 4633
http://www.vbdotnetheaven.com/Sections/GDI+.asp

Steve Amey wrote:
Hi all

I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by
using the Color.ToArgb method), is there any way that I can create a
System.Drawing.Image or a System.Drawing.Bitmap from that value?

Regards,
Steve

Jul 21 '05 #2
"From this value" is a bit vague. Do you mean you would like to create a
32x32 bitmap file that is filled with this particular color or something
similar...

If yes you may want to post the exact point that causes a problem (creating,
filling, saving etc...)

The doc for the System.Drawing namespace is at :

http://msdn.microsoft.com/library/de...temDrawing.asp

Patrice

--

"Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> a écrit dans le message
de news:%2***************@TK2MSFTNGP15.phx.gbl...
Hi all

I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by
using the Color.ToArgb method), is there any way that I can create a
System.Drawing.Image or a System.Drawing.Bitmap from that value?

Regards,
Steve

Jul 21 '05 #3

You could create a bitmap using :

Dim b As New Bitmap(32, 32)
Dim g As Graphics = Graphics.FromImage(b)

g.FillRectangle(New SolidBrush(Color.Blue), 0, 0, 32, 32)

g.Dispose()

Just use the color you want instead of Color.Blue. Not sure but depending on
the grid you are using you could also likely just alter the cell color
background (if possible) instead of using a colored bitmap.

Note that having the compoent is useless. you can use the Color object you
have...

Patrice
--

"Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> a écrit dans le message
de news:OC**************@TK2MSFTNGP14.phx.gbl...
Hi Patrice

Sorry if I'm being vague. I want to create a Bitmap or Image that is the
exact colour of the Argb values I have, then assign that Image or Bitmap to a column in a Grid Control I have. I don't need to actually save the Image
anywhere, it will only exist while the application is running.

The problem is I don't know how to create a Bitmap or Image object that will display the Colour of the Argb values.

Regards,
Steve.

"Patrice" <no****@nowhere.com> wrote in message
news:uy**************@TK2MSFTNGP15.phx.gbl...
"From this value" is a bit vague. Do you mean you would like to create a
32x32 bitmap file that is filled with this particular color or something
similar...

If yes you may want to post the exact point that causes a problem
(creating,
filling, saving etc...)

The doc for the System.Drawing namespace is at :

http://msdn.microsoft.com/library/de...temDrawing.asp
Patrice

--

"Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> a écrit dans le
message
de news:%2***************@TK2MSFTNGP15.phx.gbl...
Hi all

I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by using the Color.ToArgb method), is there any way that I can create a
System.Drawing.Image or a System.Drawing.Bitmap from that value?

Regards,
Steve



Jul 21 '05 #4
Hi Patrice

Sorry if I'm being vague. I want to create a Bitmap or Image that is the
exact colour of the Argb values I have, then assign that Image or Bitmap to
a column in a Grid Control I have. I don't need to actually save the Image
anywhere, it will only exist while the application is running.

The problem is I don't know how to create a Bitmap or Image object that will
display the Colour of the Argb values.

Regards,
Steve.

"Patrice" <no****@nowhere.com> wrote in message
news:uy**************@TK2MSFTNGP15.phx.gbl...
"From this value" is a bit vague. Do you mean you would like to create a
32x32 bitmap file that is filled with this particular color or something
similar...

If yes you may want to post the exact point that causes a problem
(creating,
filling, saving etc...)

The doc for the System.Drawing namespace is at :

http://msdn.microsoft.com/library/de...temDrawing.asp

Patrice

--

"Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> a écrit dans le
message
de news:%2***************@TK2MSFTNGP15.phx.gbl...
Hi all

I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by
using the Color.ToArgb method), is there any way that I can create a
System.Drawing.Image or a System.Drawing.Bitmap from that value?

Regards,
Steve


Jul 21 '05 #5
Lovely. Thank you for your help Patrice :o)

I could've changed the Backcolor of the Cell but I wanted more control over
the size of the image so that it doesn't fill the entire cell, changing the
size of the Bitmap and assigning it to the column looks really good.

Regards,
Steve

"Patrice" <no****@nowhere.com> wrote in message
news:eu*************@TK2MSFTNGP12.phx.gbl...

You could create a bitmap using :

Dim b As New Bitmap(32, 32)
Dim g As Graphics = Graphics.FromImage(b)

g.FillRectangle(New SolidBrush(Color.Blue), 0, 0, 32, 32)

g.Dispose()

Just use the color you want instead of Color.Blue. Not sure but depending
on
the grid you are using you could also likely just alter the cell color
background (if possible) instead of using a colored bitmap.

Note that having the compoent is useless. you can use the Color object you
have...

Patrice
--

"Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> a écrit dans le
message
de news:OC**************@TK2MSFTNGP14.phx.gbl...
Hi Patrice

Sorry if I'm being vague. I want to create a Bitmap or Image that is the
exact colour of the Argb values I have, then assign that Image or Bitmap

to
a column in a Grid Control I have. I don't need to actually save the
Image
anywhere, it will only exist while the application is running.

The problem is I don't know how to create a Bitmap or Image object that

will
display the Colour of the Argb values.

Regards,
Steve.

"Patrice" <no****@nowhere.com> wrote in message
news:uy**************@TK2MSFTNGP15.phx.gbl...
> "From this value" is a bit vague. Do you mean you would like to create
> a
> 32x32 bitmap file that is filled with this particular color or
> something
> similar...
>
> If yes you may want to post the exact point that causes a problem
> (creating,
> filling, saving etc...)
>
> The doc for the System.Drawing namespace is at :
>
> http://msdn.microsoft.com/library/de...temDrawing.asp >
> Patrice
>
> --
>
> "Steve Amey" <stevea@_RemoveThis_centurion-ms.co.uk> a écrit dans le
> message
> de news:%2***************@TK2MSFTNGP15.phx.gbl...
>> Hi all
>>
>> I have an ARGB value for a Colour (Eg. -65536. The value was retrieved by >> using the Color.ToArgb method), is there any way that I can create a
>> System.Drawing.Image or a System.Drawing.Bitmap from that value?
>>
>> Regards,
>> Steve
>>
>>
>
>



Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Prashant | last post: by
5 posts views Thread by Lance | last post: by
5 posts views Thread by Steve Amey | last post: by
5 posts views Thread by =?Utf-8?B?U2hhcm9u?= | last post: by
4 posts views Thread by alarock | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.