// This is our main window.
class MainWindow : Form
{
public MainWindow(string title, int height, int width)
{
// Set various properties from our parent classes.
Text = title;
Width = width;
Height = height;
// Inherited method to center the form on the screen.
CenterToScreen();
}
}
We can now update the call to Application.Run() as follows:
static void Main()
{
Application.Run(new MainWindow("My Window", 200, 300));
}
While this is a step in the right direction, any window worth its salt will require various user
interface elements (menu systems, status bars, buttons, etc.) to allow for input. To understand how
a Form-derived type can contain such elements, you must understand the role of the Controls prop-
erty and the underlying controls collection.
Do'stlaringiz bilan baham: |