c# - 如何更改组合框控件中的下拉按钮?

标签 c# winforms forms

如何更改 ComboBox 控件中的下拉按钮(C#、Windows 窗体)?我有一个自定义按钮,我想在 ComboBox 中使用它,而不是默认的下拉按钮。

最佳答案

我认为 Hans Passant 解决方案就是这样......

从这里开始:

http://social.msdn.microsoft.com/forums/en-US/winformsdesigner/thread/5d65f987-834c-465f-a944-622831d4cfb0

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/

相关文章:

c# - 如何避免复杂屏幕上的数据绑定(bind)/事件 hell ?

.net - 如何从字符串中删除加速符?

jquery - 跨浏览器文件上传输入黑客

node.js - 通过 Joi 验证器使用 hapi.js 中的 nodeJS 联系表单 : captcha mandatory?

c# - 如何从html链接中提取电子邮件

c# - 没有 ASP.NET AJAX 的 JQuery/WCF :

c# - 平铺对象位置与 MonoGame 位置不匹配

c# - Bitmap.GetPixel() 不返回任何内容

c# - WinForm UI 组件层顺序

javascript - 具有多个突出显示字段的表单验证