473,395 Members | 1,341 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,395 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 4797
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.