开发者

How to change drop down button in combobox control?

How to change dropdown button in a ComboBox control (C#, Wi开发者_高级运维ndows Forms)? I have a custom button, and I want to use it in the ComboBox instead of the default dropdown button.


I think Hans Passant solution is the way...

From here:

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;
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜