c# - 组合框 DropDownStyle DropDownList : Change BackColor WinForms

标签 c# winforms combobox

我正在制作一个应用程序,其中突出显示当前聚焦的控件。
对于 TextBox,我使用 BackColor 属性。

但是对于带有 DropDownStyle = DropDownListComboBoxBackColor 似乎不会使其突出显示。

关于如何使控件以一致的方式突出显示的任何建议(边框等?)。

最佳答案

正如 Reniuz 所说,您需要更改 DrawMode 属性。

具体来说,将 DrawMode 更改为 OwnerDrawFixed 将允许您指定 BackColor。

系统.DrawMode

Normal - All the elements in a control are drawn by the operating system and are of the same size.

OwnerDrawFixed - All the elements in the control are drawn manually and are of the same size.

OwnerDrawVariable - All the elements in the control are drawn manually and can differ in size.

参见 System.Windows.Forms.DrawMode获取更多信息。

关于c# - 组合框 DropDownStyle DropDownList : Change BackColor WinForms,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6223954/

相关文章:

c# - 从 c# LPCTSTR 编码不再工作

C# 从整数列表中删除项目 int[] l = {1,2,3} - 或使用递归添加它们

c# - 如何使用 C# 以编程方式复制 MS SQL 2000 数据库?

c# - 如何绑定(bind)到 ObservableCollection 的一个元素

c# - 截图并以表格形式显示

c# - 如果您在通知图标上按住 Lt-Click 或 Rt-Click,如何获得不同的上下文菜单?

c# - System.Windows.Forms.WebBrowser 不运行 Javascript

html - 避免过滤输入元素中的数据列表项

带有嵌套选项值的 jQuery 组合框?

jQuery UI 添加占位符到组合框