Create Image or Bitmap from ARGB value

  • Thread starter Thread starter Steve Amey
  • Start date Start date
S

Steve Amey

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
 
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.
 
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


--
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top