Walkthrough: Perform common tasks using designer actions
As you construct forms and controls for your Windows Forms application, there are many tasks you'll perform repeatedly. The following list shows some of the commonly performed tasks you'll come across:
- Adding or removing a tab on a TabControl.
- Docking a control to its parent.
- Changing the orientation of a SplitContainer control.
To speed development, many controls offer designer actions, which are context-sensitive menus that allow you to perform common tasks like these in a single gesture at design time. These tasks are called designer actions verbs.
Designer actions remain attached to a control instance for its lifetime in the designer and are always available.
Create the project
The first step is to create the project and set up the form.
In Visual Studio, create a Windows-based application project called DesignerActionsExample.
Select the form in the Windows Forms Designer.
Use designer actions
Designer actions are always available at design time on controls that offer them.
Click the designer actions glyph. In the shortcut menu that appears next to the glyph, select the Add Tab item. Observe that a new tab page is added to the TabControl.
Drag a TableLayoutPanel control from the Toolbox onto your form.
Click the designer actions glyph. In the shortcut menu that appears next to the glyph, select the Add Column item. Observe that a new column is added to the TableLayoutPanel control.
Drag a SplitContainer control from the Toolbox onto your form.
Click the designer actions glyph. In the shortcut menu that appears next to the glyph, select the Horizontal Splitter Orientation item. Observe that the SplitContainer control's splitter bar is now oriented horizontally.