我正在制作一个应用程序,其中突出显示当前聚焦的控件。
对于 TextBox
,我使用 BackColor
属性。
但是对于带有 DropDownStyle = DropDownList
的 ComboBox
,BackColor
似乎不会使其突出显示。
关于如何使控件以一致的方式突出显示的任何建议(边框等?)。
最佳答案
正如 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/