473,386 Members | 1,823 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,386 software developers and data experts.

convert RGB color to System.Drawing.Color?

I need to change my form's backcolor back to the design color after it
changes to
another system.Drawing.Color. In the backcolor design, the value is in RGB

me.BackColor = ...RGB(255, 255, 192)

This doesn't work. How can I change the RGB values to System.Drawing.Color?

Thanks


Nov 21 '05 #1
3 50673
I think I figured this out.

me.BackColor = ColorTranslator.FromOle(RGB(255,255,192))

The trick is ColorTranslator.FromOle(...)

"Rich" wrote:
I need to change my form's backcolor back to the design color after it
changes to
another system.Drawing.Color. In the backcolor design, the value is in RGB

me.BackColor = ...RGB(255, 255, 192)

This doesn't work. How can I change the RGB values to System.Drawing.Color?

Thanks

Nov 21 '05 #2
"Rich" <Ri**@discussions.microsoft.com> schrieb:
I need to change my form's backcolor back to the design color after it
changes to
another system.Drawing.Color. In the backcolor design, the value is in
RGB

me.BackColor = ...RGB(255, 255, 192)

This doesn't work. How can I change the RGB values to
System.Drawing.Color?


Take a look at 'Color.FromArgb'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3
Thank you. I will give that a try.

"Herfried K. Wagner [MVP]" wrote:
"Rich" <Ri**@discussions.microsoft.com> schrieb:
I need to change my form's backcolor back to the design color after it
changes to
another system.Drawing.Color. In the backcolor design, the value is in
RGB

me.BackColor = ...RGB(255, 255, 192)

This doesn't work. How can I change the RGB values to
System.Drawing.Color?


Take a look at 'Color.FromArgb'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Supra | last post by:
: error BC30311: Value of type 'System.Drawing.Color' cannot be converted to 'Integer'. Function doColor(ByVal rtb As RichTextBox, ByVal a As String, Optional ByVal f As Integer = 0, Optional...
4
by: andrewcw | last post by:
I have an xml file that I use to set values of DataGridStyles - header text, column width etc I would also like to make the background color selected other items data driven What is the smart way...
10
by: tshad | last post by:
I have a problem setting the background color of textbox on the fly. I tried using: applicantID.backcolor = "F6F6F6" and applicantID.backcolor = "#F6F6F6"
4
by: Steve | last post by:
I'm a bit baffled. I'm fairly new to VB.NET so maybe I'm missing something. I'm creating a class that has some application-specific methods and properties and one thing I'd like to do is define...
11
by: Yaniv | last post by:
Hi How can I convert Uint32 variable to System.drawing.color ?? Thanks in advanced Yaniv
1
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
Hi, Is there a way ( perhaps throgh refleksion) to iterate through the colors of the System.Drawing.Color struct. foreach (Color color in .... i dont know.... regards Jesper
2
by: manjitsarma | last post by:
In the following code ,I am getting the errors public abstract class Theme { private string sFrmBackGroundImage; private Color sFrmTransperncyColor; public object...
2
by: shapper | last post by:
Hello, How do I convert a property of System.Drawing.Color to a string, i.e., "#FFFFFF"? I have the following but it is not working: MyColor.ToString Thanks, Miguel
6
by: James Hahn | last post by:
That looks like proper Property set code to me. What is the line of code that the designer is generating in the Sub InitializeComponent for a color that you select in the Properties Settings? ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
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
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
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...

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.