如何更改 ComboBox
控件中的下拉按钮(C#、Windows 窗体)?我有一个自定义按钮,我想在 ComboBox
中使用它,而不是默认的下拉按钮。
最佳答案
我认为 Hans Passant 解决方案就是这样......
从这里开始:
You can create a UserControl, drag a ComboBox and a Button onto it, make the Button right over the ComboBox's arrow button to make the arrow button invisible, handle the Button's Paint event to draw an arrow on it, this can be done by calling ComboBoxRenderer.DrawDropDownButton() method (Notice: this method has a limit, it needs the visual style being enabled on the OS) or by drawing an icon on it, or just drawing a small triangle on it. Then handle the Click event of the button to show the ComboBox's DropDown, this can be done by something like this
private void button1_Click(object sender, EventArgs e)
{
this.comboBox1.DroppedDown = true;
}
关于c# - 如何更改组合框控件中的下拉按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5687736/