Changes

Jump to: navigation, search

Drawing Graphics using PowerShell 1.0 and GDI+

36 bytes added, 17:39, 15 May 2009
no edit summary
== Loading the GDI+ and WinForms .NET Assemblies ==
As previously mentionmentioned, Windows PowerShell GDI+ development is typically performed in conjunction with WinForms. Neither the GDI+, nor the WinForms .NET assemblies are loaded into the Windows PowerShell environment by default. It is necessary, therefore, to load these assemblies before beginning the development process. GDI+ and Winforms reside in the [Windows.Drawing] and [Windows.Windows.Forms] assemblies respectively. These can be loaded using the following commands:
<pre>
Applications with graphical user interfaces are primarily ''event driven''. This means that event handlers must be written to define what actions are to be performed when certain activities occur with regard to the user interface. When a user clicks a button, for example, an event handler performs the necessary tasks associated with that button being pressed (if the button was a Close button, the event handler would be responsible for exiting the application).
In terms of graphics drawing, when a form is displayed a ''paint'' event is triggered. Similarly, when a form needs to be repainted (for example because all or part of the form was obscured and then uncovered by another window), the paint event is also triggered. it It is, therefore, the job of the ''paint handler'' to perform the graphics drawing tasks. A paint event handler is declared in Windows PowerShell via a call to ''add_paint()'':
<pre>
[[Image:windows_powershell_gdi_example.jpg|A Windows PowerShell/GDI+ Example]]
 
 
<google>BUY_WPS_BOTTOM</google>

Navigation menu