Using C#, is it possible to change the BackGround color of a comboBox?
I tried to use this one
cmbBox1 = the namespace of the combobox
cmbBox1.BackgroundColor = Color.Red;
I't wont work.
Is there any way to put some new codes so I could change its backcolor?
(Without editing stuff from the properties window)
Also,
from the comboBox, i have this two item: red and blue. when i clicked the button 'Change Color' (btnColor), the button should change it's background color. is it possible to use if or switch statement? how?
Mervha NifflemhellPosted Jan 25, 2008, 8:59 PM
I really got it right before you sent you reply. But anyway, thanks.
I got another big problem.
I have this listbox (lstBoxColor) wherein if you click the btnChangeColor, the listBox will display what color you have chosen.
e.g.
1st click - => 0 - Blue (if i choose blue)
2nd click - => 1 - Red (if i choose red)
3rd click - => 2 - Red (if i choose red again)
and so on...
got any ideas?
Scott LyslePosted Jan 25, 2008, 6:02 PM
I missed the other part of the question:
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { switch (comboBox2.Text) { case "Red": comboBox2.BackColor = Color.Red; break; case "Blue": comboBox2.BackColor = Color.Blue; break; default: break; } }Scott LyslePosted Jan 25, 2008, 5:55 PM
comboBox1.BackColor =
Color.Azure;