DropdownStyle为DropDownList时如何更改ComboBox的BackColor? [英] How to change the BackColor of a ComboBox when DropdownStyle is DropDownList?

查看:353
本文介绍了DropdownStyle为DropDownList时如何更改ComboBox的BackColor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DropdownStyle 属性为<$ c $时,我试图更改 ComboBox 的显示颜色c> DropdownList 。当属性从 DropdownList 更改为 Dropdown 时,颜色也会更改。

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 ?

谢谢

推荐答案

您可以设置 FlatStyle 属性设置为 弹出窗口 。这样,背景色将在 DropDown DropDownList 模式下使用。

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

如果您不喜欢平面样式,或者需要在呈现 ComboBox 时进行更多自定义,则可以使用所有者绘制的 ComboBox 。例如,您可以设置 DrawMode 属性设置为 OwnerDrawFixed 并处理 DrawItem 事件,并根据您的逻辑绘制组合框。

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.

这篇关于DropdownStyle为DropDownList时如何更改ComboBox的BackColor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆