Building a GUI using Windows Forms
The first option that we will discuss is Windows Forms. To utilize Windows Forms, we first need to load the respective assemblies. We can load the assemblies by using the following techniques:
[void][System.Reflection.Assembly]::LoadWithPartialName ("System.Drawing") [void][System.Reflection.Assembly]::LoadWithPartialName ("System.Windows.Forms")
Alternatively, we can use the following technique:
Add-Type -AssemblyNameSystem.Windows.Forms Add-Type -AssemblyNameSystem.Drawing
Once the assemblies are loaded, we need to load the visual styles method as well. We can load the module by using the following method:
[void] [System.Windows.Forms.Application]::EnableVisualStyles()
I prefer using [void]
to add the assemblies because it would suppress unnecessary text output. For the rest of the examples, we will use the following three lines to load the assemblies and the method:
[void][System.Reflection.Assembly]::LoadWithPartialName ("System.Drawing...