1. Initialising the Form - CodeBlueG/PSForms GitHub Wiki

Before any fields are added to a form, the form must be set up and initialised.

This is done with a single command and should be directed to a variable:-

  $Script:TestForm = Initialize-Form

This will create a form object that will be used throughout the project which will have various default settings. I will usually make the variable a script variable so that it is readable from within and functions that might call it.

Once the form has been initialised, the default settings can be changed as required. The following list shows the settings and their default values;

FormTitle - "Windows Form"
FormVersion - "1.0"
ColWidthOdd - 150
ColWidthEven - 200
VertSpace - 5
HorizSpace -  16
RowHeight - 20
ButtonWidth - 90
ButtonHeight - 20
formFont - SystemFonts.MessageBoxFont 
formFontSize - 8

These settings are changed using the following syntax (this is standard PowerShell, not specific to this module);

  $TestForm.FormTitle = "A Test Form"