Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text button on toolbar

I want to add a text button onto a WinForms toolbar (a standard button on a toolbar can contain an image only).

A textbox, a combobox can be easily added onto a toolbar but there is no option for a text button.

How can that be achieved?

UPD By 'text button' I mean the standard Windows button.

like image 426
Centro Avatar asked Feb 23 '23 10:02

Centro


2 Answers

Set ToolStripItem.DisplayStyle to Text :

var toolStripButton = new ToolStripButton();
toolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Text;
like image 65
Chris Xue Avatar answered Mar 08 '23 11:03

Chris Xue


You can use a ToolStripControlHost to embed any control in your toolstrip:

Button button = new Button();
button.Text = "Standard Windows Button";
yourToolStrip.Items.Add(new ToolStripControlHost(button));
like image 31
Frédéric Hamidi Avatar answered Mar 08 '23 12:03

Frédéric Hamidi