在表单中更改Combobox的颜色 [英] Change the color of Combobox in form
问题描述
Hello Experts,
我有组合框,我想改变它的颜色。在谷歌搜索后,我发现了这一点。
http:// stackoverflow.com/questions/13212179/changing-the-color-of-combobox-highlighting [ ^ ]
现在我不知道如何使用这个类。我刚刚用上面链接中提到的代码创建了一个类。但是如何为我想要的组合框调用/执行该类。
请帮助我理解这一点。
Hello Experts,
I have Combo box and I want to change the color of it. After searching in google, I found this.
http://stackoverflow.com/questions/13212179/changing-the-color-of-combobox-highlighting[^]
Now I am stuck with how to use this class. I just created a class with the code as mentioned in above link. But how do I call/ execute that class for a combobox I want to.
Please help me in understanding this.
推荐答案
你需要使用这个类AdvancedComboBox:ComboBox而不是你的ComboBox控件。此方法称为子类,您可以查看如何执行此操作:
You need to use this class AdvancedComboBox : ComboBox instead of your ComboBox Control. This method is called "Subclassing" and you can take a look how to do it:
如何使用Visual Basic .NET在Windows窗体中创建窗口
How to subclass windows in Windows Forms by using Visual Basic .NET
[ ^ ]
我宁愿简单地使用一个地方在WinForm中持有并在源代码中创建一个控件,如下所示:
[^]
I would rather simply use a place holder in the WinForm and create a control in the source code like this:
Dim oCmbBox As AdvancedComboBox = New AdvancedComboBox()
然后你可以使用占位符的坐标将它移动到正确的位置......
Then you can move it on the right place using the coordinates of the place holder ...
这篇关于在表单中更改Combobox的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!