Comment on page
Windows Forms Designer
The Windows Form Designer is only supported on Windows.
Building A Windows Form with PowerShell in Visual Studio Code
Create a PowerShell script by clicking File \ New File, entering the name of the file with a
.PS1extension. This will be the script that is used to launch your form.
To open the designer press
Ctrl+Shift+Pand then type
Show Windows Forms Designer. The
PowerShell Pro Tools: Show Forms Designercommand 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.
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.
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.
Event handler 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.