Creating a Simple Windows Form

Classes that are responsible for the functionality of windows reside in the System.Windows.Forms namespace. Whenever we create a PerlNET application involving a GUI, we must define a new class that extends the Form class from this namespace. Form handles standard window operations: resizing, moving, closing, and so on. Classes that inherit from Form are also referred as Winforms. Additionally, we have to declare explicitly the Main method for the starting class, which will be the entry point to our program.

Creating a Window

Here is the simple PerlNET window application from the SimpleWinform folder:

 # # SimpleWinform.pl # package SimpleWinform; use strict; use namespace "System"; use namespace "System.Windows.Forms"; ...

Get Programming PERL in the .NET Environment now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.