- Back to Home »
- Windows Applications »
- ToolStrip
Posted by :
Sudhir Chekuri
Thursday, 18 February 2016
It is a menu present at the top of the form which is capable of hosting Button, Label, SplitButton, DropDownButton, Separator, ComboBox, TextBox and ProgressBar controls.
Default Event: Click which is fired when user click on the controls in toolbox.
Steps to create ToolStrip
Drag and drop a ToolStrip control to the form which is displayed on the bottom panel of the form but also shows up the dropdown with list of controls at the top of the form.
You can use the dropdown available at the top of the form to select and add controls in the ToolStrip which is present at the top of the form.
Double click on the ToolStrip item to see the generated event handler of that specific item and you can create event handler for each item to write some code that has to be executed when you click on that item in the runtime.
Default Event: Click which is fired when user click on the controls in toolbox.
Steps to create ToolStrip
Drag and drop a ToolStrip control to the form which is displayed on the bottom panel of the form but also shows up the dropdown with list of controls at the top of the form.
You can use the dropdown available at the top of the form to select and add controls in the ToolStrip which is present at the top of the form.
Double click on the ToolStrip item to see the generated event handler of that specific item and you can create event handler for each item to write some code that has to be executed when you click on that item in the runtime.
Example
to display message box when you click on ToolStrip item
private void toolStripComboBox1_Click(object sender, EventArgs e)
{
MessageBox.Show("You selected combo box in
toolstrip");
}
private void toolStripLabel1_Click(object
sender, EventArgs e)
{
MessageBox.Show("You selected label in
toolstrip");
}