This article has been excerpted from book "The Complete Visual C# Programmer's Guide from the Authors of C# Corner".The main window of your Windows application is a form, derived from the ContainerControl class. A form is a representation of a window in .NET. You can use the Form class to create Single Document Interface (SDI), Multiple Document Interface (MDI), and dialog-based applications. The windows can be borderless, transparent, and floating. You can create an MDI form by setting the IsMDIContainer property to true. To make a form an MDI child, set the MdiParent property with a reference to the MDI container form. To display the child, the child form's Show method must be called or its Visible property set to true.You can change the appearance, size, and color of a form by using the Properties window. You can use the Form class members to set properties or override event handler methods at runtime. The Form class contains properties and methods too numerous to completely itemize. Among the interesting ones are the following:
Table 9.6 describes some other members of the Form class. Table 9.6: Form Class Members Using the properties and methods of the Form class you can alter the appearance of the form.Listing 9.6 contains some samples that can change the appearance and functionality of the form. Listing 9.6: Changing the appearance of the form // Set the font of the form.form1.Font = new System.Drawing.Font ("Verdana", 10,System.Drawing.FontStyle.Bold);// Make the Form transparent.form1.Opacity = 0.50;// Make the Form topmost.form1.TopMost = true;// Set the title bar text of the form.form1.Text = "My Dialog Box";// Display a help button on the form.form1.HelpButton = true;// Define the border style of the form to that of a dialog box.form1.FormBorderStyle = FormBorderStyle.FixedDialog;// Set the MaximizeBox to false to remove the maximize box.form1.MaximizeBox = false;// Display the form as a modal dialog box.form1.ShowDialog();ConclusionHope this article would have helped you in understanding the Form Class – using C#. See other articles on the website on .NET and C#.