![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. Help! |
#3
| |||
| |||
|
|
color.fromArgb(rr, gg, bb) where rr, gg, bb are the red, green and blue values that should be mixed to produce the color you desire. Microsoft can supply the color class with every color under the sun. They've provided a good base of colors, but for custom colors, you'll need to supply the ingredients yourself. "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:43066b16$0$97123$ed2619ec (AT) ptn-nntp-reader03 (DOT) plus.net... I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. Help! |
#4
| |||
| |||
|
|
When I manually look at the properties of a web control and check it's backcolor, I see that the color 'Gainsboro' has been selected from the web color palette. Is it true that in code you cannot change a control's backcolor to another color from the web palette? I am a novice programmer, but this seems very strange that you need to reference code color changes using RGB references, when manually you can using defined named colors. If this is the case where do you get the RGB values for each names colour? PWS "Scott M." <s-mar (AT) nospam (DOT) nospam> wrote in message news:e9J6ZeRpFHA.764 (AT) TK2MSFTNGP14 (DOT) phx.gbl... color.fromArgb(rr, gg, bb) where rr, gg, bb are the red, green and blue values that should be mixed to produce the color you desire. Microsoft can supply the color class with every color under the sun. They've provided a good base of colors, but for custom colors, you'll need to supply the ingredients yourself. "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:43066b16$0$97123$ed2619ec (AT) ptn-nntp-reader03 (DOT) plus.net... I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. Help! |
#5
| |||
| |||
|
|
While the Properties window does show Gainsboro in the list, remember that the values you select in the Properties window for web forms controls must be able to be expressed (or better yet, rendered) to the client (browser) as something the browser will understand. This is why a Web Forms control might start out as: <ASP:Button>, but it winds up in the client as <INPUT TYPE="Submit">. The same is true with property values. The only way to specify a background color for an HTML control is via Cascading Style Sheets and the STYLE attribute of the <INPUT> tag. Now, here's the important part: in CSS, Gainsboro is a valid value for the "background-color:" style sheet property, BUT there are 2 additional things to consider... 1. Gainsboro is just a name that your video card must be able to present to you. Not everyone has the same video card that you have and it is quite possible that many people's systems will have no idea what Gainsboro is. 2. Even though on your system Gainsboro is a known color and even though the Cascading Style Sheet language accepts Gainsboro as a value for the "background-color:" style property, when you are working in .NET code, you are not working in the Cascading Style Sheet language. You are working in a different language that will be processed by a web server and the .NET Framework, not a client browser and a video card. Because of this, you must use the Color class. Microsoft certainly can't create constant values in the color class for every color there is, so they created constants exposed as properties for quite a few common colors. For all other colors, they gave us the "FromARGB" method to "mix" up a color as we see fit. To get the RGB of virtually any named color, a simple Google search on: "gainsboro rgb" returns as the very first result, that 220, 220, 220 is the RGB for Gainsboro. -Scott "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:4306cde4$0$17495$ed2e19e4 (AT) ptn-nntp-reader04 (DOT) plus.net... When I manually look at the properties of a web control and check it's backcolor, I see that the color 'Gainsboro' has been selected from the web color palette. Is it true that in code you cannot change a control's backcolor to another color from the web palette? I am a novice programmer, but this seems very strange that you need to reference code color changes using RGB references, when manually you can using defined named colors. If this is the case where do you get the RGB values for each names colour? PWS "Scott M." <s-mar (AT) nospam (DOT) nospam> wrote in message news:e9J6ZeRpFHA.764 (AT) TK2MSFTNGP14 (DOT) phx.gbl... color.fromArgb(rr, gg, bb) where rr, gg, bb are the red, green and blue values that should be mixed to produce the color you desire. Microsoft can supply the color class with every color under the sun. They've provided a good base of colors, but for custom colors, you'll need to supply the ingredients yourself. "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:43066b16$0$97123$ed2619ec (AT) ptn-nntp-reader03 (DOT) plus.net... I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. Help! |
#6
| |||
| |||
|
|
Scott, Thank you for taking the time to give such a detailed explanation, I do appreciate, and now understand, the issue. PWS "Scott M." <s-mar (AT) nospam (DOT) nospam> wrote in message news:OHxTe9apFHA.3256 (AT) TK2MSFTNGP12 (DOT) phx.gbl... While the Properties window does show Gainsboro in the list, remember that the values you select in the Properties window for web forms controls must be able to be expressed (or better yet, rendered) to the client (browser) as something the browser will understand. This is why a Web Forms control might start out as: <ASP:Button>, but it winds up in the client as <INPUT TYPE="Submit">. The same is true with property values. The only way to specify a background color for an HTML control is via Cascading Style Sheets and the STYLE attribute of the <INPUT> tag. Now, here's the important part: in CSS, Gainsboro is a valid value for the "background-color:" style sheet property, BUT there are 2 additional things to consider... 1. Gainsboro is just a name that your video card must be able to present to you. Not everyone has the same video card that you have and it is quite possible that many people's systems will have no idea what Gainsboro is. 2. Even though on your system Gainsboro is a known color and even though the Cascading Style Sheet language accepts Gainsboro as a value for the "background-color:" style property, when you are working in .NET code, you are not working in the Cascading Style Sheet language. You are working in a different language that will be processed by a web server and the .NET Framework, not a client browser and a video card. Because of this, you must use the Color class. Microsoft certainly can't create constant values in the color class for every color there is, so they created constants exposed as properties for quite a few common colors. For all other colors, they gave us the "FromARGB" method to "mix" up a color as we see fit. To get the RGB of virtually any named color, a simple Google search on: "gainsboro rgb" returns as the very first result, that 220, 220, 220 is the RGB for Gainsboro. -Scott "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:4306cde4$0$17495$ed2e19e4 (AT) ptn-nntp-reader04 (DOT) plus.net... When I manually look at the properties of a web control and check it's backcolor, I see that the color 'Gainsboro' has been selected from the web color palette. Is it true that in code you cannot change a control's backcolor to another color from the web palette? I am a novice programmer, but this seems very strange that you need to reference code color changes using RGB references, when manually you can using defined named colors. If this is the case where do you get the RGB values for each names colour? PWS "Scott M." <s-mar (AT) nospam (DOT) nospam> wrote in message news:e9J6ZeRpFHA.764 (AT) TK2MSFTNGP14 (DOT) phx.gbl... color.fromArgb(rr, gg, bb) where rr, gg, bb are the red, green and blue values that should be mixed to produce the color you desire. Microsoft can supply the color class with every color under the sun. They've provided a good base of colors, but for custom colors, you'll need to supply the ingredients yourself. "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:43066b16$0$97123$ed2619ec (AT) ptn-nntp-reader03 (DOT) plus.net... I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. Help! |
#7
| |||
| |||
|
|
While the Properties window does show Gainsboro in the list, remember that the values you select in the Properties window for web forms controls must be able to be expressed (or better yet, rendered) to the client (browser) as something the browser will understand. This is why a Web Forms control might start out as: <ASP:Button>, but it winds up in the client as <INPUT TYPE="Submit">. The same is true with property values. The only way to specify a background color for an HTML control is via Cascading Style Sheets and the STYLE attribute of the <INPUT> tag. Now, here's the important part: in CSS, Gainsboro is a valid value for the "background-color:" style sheet property, BUT there are 2 additional things to consider... 1. Gainsboro is just a name that your video card must be able to present to you. Not everyone has the same video card that you have and it is quite possible that many people's systems will have no idea what Gainsboro is. 2. Even though on your system Gainsboro is a known color and even though the Cascading Style Sheet language accepts Gainsboro as a value for the "background-color:" style property, when you are working in .NET code, you are not working in the Cascading Style Sheet language. You are working in a different language that will be processed by a web server and the .NET Framework, not a client browser and a video card. Because of this, you must use the Color class. Microsoft certainly can't create constant values in the color class for every color there is, so they created constants exposed as properties for quite a few common colors. For all other colors, they gave us the "FromARGB" method to "mix" up a color as we see fit. To get the RGB of virtually any named color, a simple Google search on: "gainsboro rgb" returns as the very first result, that 220, 220, 220 is the RGB for Gainsboro. -Scott "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:4306cde4$0$17495$ed2e19e4 (AT) ptn-nntp-reader04 (DOT) plus.net... When I manually look at the properties of a web control and check it's backcolor, I see that the color 'Gainsboro' has been selected from the web color palette. Is it true that in code you cannot change a control's backcolor to another color from the web palette? I am a novice programmer, but this seems very strange that you need to reference code color changes using RGB references, when manually you can using defined named colors. If this is the case where do you get the RGB values for each names colour? PWS "Scott M." <s-mar (AT) nospam (DOT) nospam> wrote in message news:e9J6ZeRpFHA.764 (AT) TK2MSFTNGP14 (DOT) phx.gbl... color.fromArgb(rr, gg, bb) where rr, gg, bb are the red, green and blue values that should be mixed to produce the color you desire. Microsoft can supply the color class with every color under the sun. They've provided a good base of colors, but for custom colors, you'll need to supply the ingredients yourself. "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:43066b16$0$97123$ed2619ec (AT) ptn-nntp-reader03 (DOT) plus.net... I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. Help! |
#8
| |||||
| |||||
|
|
Excuse me, but I seriously don't think that the type of video card that you have in your computer has anything to do with this. |
|
The color "Gainsboro" would likely be defined in some web standard. As long as the browsers *rendering engine* can interpret what Gainsboro should be, it'll display fine. |
|
The code that you are working on is executed server side. The resultant output of this execution is valid HTML. |
|
The Color struct cotains definitions for a set number of colors. If you want to use a colour that is not provided, then you use the RGB representation instead. |
|
"Scott M." <s-mar (AT) nospam (DOT) nospam> wrote in message news:OHxTe9apFHA.3256 (AT) TK2MSFTNGP12 (DOT) phx.gbl... While the Properties window does show Gainsboro in the list, remember that the values you select in the Properties window for web forms controls must be able to be expressed (or better yet, rendered) to the client (browser) as something the browser will understand. This is why a Web Forms control might start out as: <ASP:Button>, but it winds up in the client as <INPUT TYPE="Submit">. The same is true with property values. The only way to specify a background color for an HTML control is via Cascading Style Sheets and the STYLE attribute of the <INPUT> tag. Now, here's the important part: in CSS, Gainsboro is a valid value for the "background-color:" style sheet property, BUT there are 2 additional things to consider... 1. Gainsboro is just a name that your video card must be able to present to you. Not everyone has the same video card that you have and it is quite possible that many people's systems will have no idea what Gainsboro is. 2. Even though on your system Gainsboro is a known color and even though the Cascading Style Sheet language accepts Gainsboro as a value for the "background-color:" style property, when you are working in .NET code, you are not working in the Cascading Style Sheet language. You are working in a different language that will be processed by a web server and the .NET Framework, not a client browser and a video card. Because of this, you must use the Color class. Microsoft certainly can't create constant values in the color class for every color there is, so they created constants exposed as properties for quite a few common colors. For all other colors, they gave us the "FromARGB" method to "mix" up a color as we see fit. To get the RGB of virtually any named color, a simple Google search on: "gainsboro rgb" returns as the very first result, that 220, 220, 220 is the RGB for Gainsboro. -Scott "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:4306cde4$0$17495$ed2e19e4 (AT) ptn-nntp-reader04 (DOT) plus.net... When I manually look at the properties of a web control and check it's backcolor, I see that the color 'Gainsboro' has been selected from the web color palette. Is it true that in code you cannot change a control's backcolor to another color from the web palette? I am a novice programmer, but this seems very strange that you need to reference code color changes using RGB references, when manually you can using defined named colors. If this is the case where do you get the RGB values for each names colour? PWS "Scott M." <s-mar (AT) nospam (DOT) nospam> wrote in message news:e9J6ZeRpFHA.764 (AT) TK2MSFTNGP14 (DOT) phx.gbl... color.fromArgb(rr, gg, bb) where rr, gg, bb are the red, green and blue values that should be mixed to produce the color you desire. Microsoft can supply the color class with every color under the sun. They've provided a good base of colors, but for custom colors, you'll need to supply the ingredients yourself. "Paul Smith" <pws (AT) twelve (DOT) me.uk> wrote in message news:43066b16$0$97123$ed2619ec (AT) ptn-nntp-reader03 (DOT) plus.net... I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. Help! |
#9
| |||
| |||
|
|
I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. |
#10
| |||
| |||
|
|
"Paul Smith" <pws (AT) twelve (DOT) me.uk> ha scritto nel messaggio news:43066b16$0$97123$ed2619ec@ptn-nntp- I have a button on my web page the backcolor of which I want to change: btnSample.backcolor = ???????? I want the color to be Gainsboro However I enter Gainsboro or color.Gainsboro I have the blue wavy line indicating an error. What is the error? in C# (case sensitive) you need to write btnSample.BackColor = Color.Gainsboro; It's really no matther if the value came from the Web palette or it is in RGB: it's a System.Drawing.Color and this is all you need. -- .Net Reporting tool: http://www.neodatatype.net |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |