Windows Forms Designer

The Windows Form Designer is only supported on Windows.

Creating a New Form

Create a PowerShell script by clicking File \ New File, entering the name of the file with a .PS1 extension. This will be the script that is used to launch your form.

Opening the Designer

To open the designer press Ctrl+Shift+P and then type Show Windows Forms Designer . The PowerShell Pro Tools: Show Forms Designer command should be show. Click or press enter.

You can also open a form by clicking the Show Windows Forms Designer button in the tool bar of a PS1 file.

Working with the Designer

The designer is very much like the standard Visual Studio designer. The design surface on the left allows you to modify your form. You can resize and delete controls from the bottom.

On the right right it provides a toolbox with controls that can be selected and placed on the form. The add a new control, click the control you'd like to place and then click the design surface of where you would like to place the control.

Below the toolbox is the properties dialog. You can select a control and modify its properties within this control.

On the bottom of the designer is a status bar. It displays the file that is being modified by the designer. An asterisk will be shown when the form is modified.

Event Handlers

To implement an event handler, double click on the control you'd like to add the event handler to. It will automatically generate the event handler code in Visual Studio Code.

Event handlers can also be generated by clicking the event handler tab in the property pane.

To create a new event handler, type the name of the handler in the text box next to the event handler. Once you press enter and then save the form, with Ctrl+s or the Save button, the event handler will be generated in the code file.

Last updated