开发者

Read only combobox?

How do I make a combobox read only? I remember back when I used VS2005 you could have a read only combobox in the default style. Reason I don't want to use DropDownList is because it looks ugly on forms that don't use a default color. Here is an example.

Read only combobox?

I want one like in the left of this picture.

Read only combobox?

Were you can no开发者_运维问答t enter in your own text. But I don't want the style in the first image to the right.


Set the drop down style to DropDownList and the flatStyle to Flat:

this.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

You can select always the element[0] (if exists) to look like the example you provided.

The Visual Studio combo draws a border OnMouseHover, you can also do this if you want.


Change the drop down style, it's a property.

See: http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.dropdownstyle.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜