473,320 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 4789
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Prashant | last post by:
Hi, I have a huge problem. I have a data file which looks something like this -: ..1 .5 .9 -1 .2 .5 ...... ..2 .9 .1 .4 .3 -1 ...... ..2 .4 .5 .7 .6 .2 ...... ........
3
by: Bradford | last post by:
I have an Windows application that displays lots of different colored lines in a Panel by using the Graphics.DrawLine method. The location and length of each line comes from a database query that...
3
by: Joe Black | last post by:
Hi everyone, I have a pesky little problem that is driving me nuts. I'm trying to capture an image of a web page programmatically in a background thread or process. What I'd like to do is create...
5
by: Lance | last post by:
I need to create a Drawing.Bitmap from an array of integer values. My current technique creates a bitmap that eventually becomes corrupt (i.e., the bitmap's pixels change to a different color...
5
by: Steve Amey | last post by:
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...
5
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hello, I'm using a control (black box control) in my form (an ActiveX/Com control). and I need to take the control as an image. The controls is showing some kind of graph, and I want to create a...
4
by: alarock | last post by:
hi, I have performed some drawing using Vector image,DrawRectangle etc... and then i converted to raster Image(bitmap) i found in the zoomed raster image(bitmap) the outer...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.