带有白色背景的组合框DropDownList样式 [英] Combobox DropDownList Style with white background
本文介绍了带有白色背景的组合框DropDownList样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想拥有一个不可编辑的ComboBox,但仍显示白色背景色,因此它的样式实际上类似于默认的ComboBox样式(DropDown)。 ComboBoxStyle.DropDownList仅提供标准的禁用外观灰色底色。只需设置BackColor = Color.White无效。
I want to have an uneditable ComboBox but still show a white background colour, so it is effectively styled like the default ComboBox style (DropDown). The ComboBoxStyle.DropDownList only provides the standard "disabled" looking grey back colour. Simply setting BackColor = Color.White has no effect.
DropDownList:
DropDownList:
DropDown:
DropDown:
推荐答案
使ComboBox DropDownList看起来像ComboBox DropDown:
To make a ComboBox DropDownList look like a ComboBox DropDown:
- 将组合框添加到WinForm。转到属性资源管理器。选择DropDownStyle> DropDownList。然后选择FlatStyle> Flat。
- 将面板添加到WinForm。转到属性资源管理器。选择 BorderStyle> FixedSingle。
- 将ComboBox拖到面板上。在ComboBox处于活动状态时,转到属性资源管理器>停靠>填充。
- 在ComboBox处于活动状态时,按住 Shift键,选择面板也将其激活(选择顺序很重要)。 )。
- 转到布局工具栏(视图>工具栏>布局),然后选择制作相同大小。
- 在运行程序时, DropDownList ComboBox应该看起来像DropDown ComboBox
- Add a ComboBox to the WinForm. Go to Properties Explorer. Select DropDownStyle > DropDownList. Then select FlatStyle > Flat.
- Add a Panel to the WinForm. Go to Properties Explorer. Select BorderStyle > FixedSingle.
- Drag ComboBox onto Panel. With ComboBox active, go to Properties Explorer > Dock > Fill.
- With ComboBox active, hold the ‘Shift’ key, select the Panel to make it active as well (order of selection is important).
- Go to the Layout Toolbar (View > ToolBars > Layout) and select ‘Make Same Size’.
- When you run your program, the DropDownList ComboBox should look like a DropDown ComboBox
这篇关于带有白色背景的组合框DropDownList样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文