C#:How to change the color of a disabled Combobox control?
-
hi help me how to change the color of a readonly textbox and a Disabled combobox contrl to look like a normal one.
comboBox1.Enabled = false; comboBox1.BackColor = System.Drawing.Color.Yellow;
senthil
First of all, why? The point behind making a control appear disabled is to stop the users from interacting with it. Anyways. You can't do it directly. It will always be gray. However, you can create your own control that inherits from the combobox and you can change that any way you please. Post back if you need more help or vote if this answers your question.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook "There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib "Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
-
First of all, why? The point behind making a control appear disabled is to stop the users from interacting with it. Anyways. You can't do it directly. It will always be gray. However, you can create your own control that inherits from the combobox and you can change that any way you please. Post back if you need more help or vote if this answers your question.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook "There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib "Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
-
hi mustafa assalamu alaikum my need is even though its a disabled contrl it should look like normal. i am beginner , can u tell me in detail thanku ssk
ssk
-
hi mustafa assalamu alaikum my need is even though its a disabled contrl it should look like normal. i am beginner , can u tell me in detail thanku ssk
ssk
Wa Alaikum Al Salam This Walkthrough will cover how to create the inherited control. http://msdn2.microsoft.com/en-us/library/5h0k2e6x(VS.80).aspx[^] Then, you'll have to handle the OnEnabledChanged event in your inherited control and take it from there. What you'll need is to either maintain the look and feel of the control or make it so that it is read only. [edit] Or read Davey's response, he gave you the whole she-bang!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook "There is no wealth like knowledge, no poverty like ignorance." Ali ibn Abi Talib "Animadvertistine, ubicumque stes, fumum recta in faciem ferri?"
-
hi help me how to change the color of a readonly textbox and a Disabled combobox contrl to look like a normal one.
comboBox1.Enabled = false; comboBox1.BackColor = System.Drawing.Color.Yellow;
senthil
This is a guess, but I think you can do it by overriding the OnPaint method.
V.
Stop smoking so you can: Enjoy longer the money you save. Moviereview Archive