Reputation: 411
I am having the combobox of dropdownstyle - dropdownlist it is noneditable but in windows 7, its back color cannot be changed.so i want a non editable drop down down combobox .
Upvotes: 0
Views: 4032
Reputation: 389
stay on your comboBox and search the dropstyle property from properties window and then choose dropdown list;
Upvotes: 0
Reputation: 576
There is two way to set the backcolor
First way
set the combobox property
comboBox1.DrawMode = DrawMode.OwnerDrawFixed;
then implement DrawItem event handler (sample code below)
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index > -1)
{
e.DrawBackground();
e.Graphics.DrawString(comboBox1.Items[e.Index].ToString(), this.Font, Brushes.Black, e.Bounds);
e.DrawFocusRectangle();
}
}
Second way set the combobox property
comboBox1.FlatStyle = FlatStyle.Flat;
Then use the backcolor you needed for the combobox
Upvotes: 1