The previous examples are both simple, fixed-size forms that have no minimize or restore button. The border style of the form object controls how a form is shown and if it can be resized.
Listing 3.1.4 shows a very simple Windows Forms application with a sizable client area.
Listing 3.1.4 resize.cs: A Simple Resizable Windows Forms Application
using System; using System.Drawing; using System.ComponentModel; using System.WinForms; public class SizeApp : System.WinForms.Form { public SizeApp() { this.Text = "SizeApp"; this.MaximizeBox = true; this.BorderStyle = FormBorderStyle.Sizable; } static void Main() { Application.Run(new SizeApp()); } }
Building and running this application will result in a resizable application that can also be minimized to the taskbar and restored in the normal way.
Comments