473,508 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4815
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
556
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
31094
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
2560
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
7348
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
328
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
3583
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
1789
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
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7133
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7066
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.