473,785 Members | 2,792 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 4861
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@_Remove This_centurion-ms.co.uk> a écrit dans le message
de news:%2******** *******@TK2MSFT NGP15.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.FromIm age(b)

g.FillRectangle (New SolidBrush(Colo r.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@_Remove This_centurion-ms.co.uk> a écrit dans le message
de news:OC******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP15.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@_Remove This_centurion-ms.co.uk> a écrit dans le
message
de news:%2******** *******@TK2MSFT NGP15.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******** ******@TK2MSFTN GP15.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@_Remove This_centurion-ms.co.uk> a écrit dans le
message
de news:%2******** *******@TK2MSFT NGP15.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******** *****@TK2MSFTNG P12.phx.gbl...

You could create a bitmap using :

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

g.FillRectangle (New SolidBrush(Colo r.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@_Remove This_centurion-ms.co.uk> a écrit dans le
message
de news:OC******** ******@TK2MSFTN GP14.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******** ******@TK2MSFTN GP15.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@_Remove This_centurion-ms.co.uk> a écrit dans le
> message
> de news:%2******** *******@TK2MSFT NGP15.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
31111
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 takes two minutes to complete. I am using the Panel's Paint event to call my drawing method, which accepts PaintEventArgs as a parameter. The problem is that every time the Window is moved or hidden, it needs to be repainted, which takes a long time...
3
2569
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 a Bitmap object of a webpage from, say, the new WebBrowser control of .net 2.0 or even the old ActiveX browser control, without opening any forms. I tried with the new WebBrowser control, but the only thing I've managed to do is open up a form...
5
7377
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 after a while). Can somebody please tell me what I'm doing wrong? Here is a sample: Public Shared Function CreateBitmapFromArray( _ ByVal width As Integer, _ ByVal height As Integer, _ ByVal pixelFormat As Drawing.Imaging.PixelFormat, _
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 System.Drawing.Bitmap from that value? Regards, Steve
5
3595
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 bitmap file out of this control, so the bitmap will show what the control is showing. I tried this: ///////////////////////////////////////////////////////////////// AxTheControl.AxControl ctrl = new AxTheControl.AxControl();
4
1812
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 boundary of the raster image(bitmap) is blurry. i used Interpolation mode,smoothing mode,,and tried a lot ..... i cant able to solve this problem in C#...Please help me to solve this...... Regards, alarock(algates)
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10336
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10095
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8978
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.