How to change the BackColor of a ComboBox when DropdownStyle is DropDownList?

混江龙づ霸主 提交于 2019-12-08 17:09:55

问题


I'm trying to change the dispaly color of a ComboBox when the DropdownStyle property is DropdownList. When the property is changed to Dropdown from DropdownList the color changes.

How can I control the view color of the dropdown boxes ?

Thanks


回答1:


You can set FlatStyle property to Popup. This way the back color will use in both DropDown and DropDownList mode.

If you don't like flat style or you need more customization on rendering of ComboBox, you can use an owner-drawn ComboBox. For example you can set DrawMode property to OwnerDrawFixed and handle DrawItem event and draw the combo box based on your logic.



来源:https://stackoverflow.com/questions/36345082/how-to-change-the-backcolor-of-a-combobox-when-dropdownstyle-is-dropdownlist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!