using System; using System.Windows.Forms; namespace FormSizeTest { public class SizedForm : Form { public SizedForm() { InitializeComponent(); this.SizedForm_Resize(null, null); } private System.ComponentModel.IContainer components = null; protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.SuspendLayout(); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(632, 453); this.MaximumSize = new System.Drawing.Size(800, 600); this.MinimumSize = new System.Drawing.Size(320, 240); this.Resize += new System.EventHandler(SizedForm_Resize); this.Name = "SizedForm"; this.Text = "SizedForm"; this.ResumeLayout(false); } void SizedForm_Resize(object sender, System.EventArgs e) { this.Text = string.Format("min ({0}x{1}), max ({2}x{3}), current ({4}x{5})", MinimumSize.Width, MinimumSize.Height, MaximumSize.Width, MaximumSize.Height, Width, Height); } } static class Program { [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new SizedForm()); } } }