System.Windows.Forms.Form.AutoSize Property

Resize the form according to the setting of Form.AutoSizeMode.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible)]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)]
[System.ComponentModel.Browsable(true)]
public override bool AutoSize { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use Form.AutoSize to force a form to resize to fit its contents.

A form does not automatically resize in the Visual Studio forms designer, regardless of the values of the Form.AutoSize and Form.AutoSizeMode properties. The form correctly resizes itself at run time according to the values of these two properties. By contrast, a custom System.Windows.Forms.UserControl automatically resizes itself both at design time and at run time.

When using Form.AutoSize, the Control.MinimumSize and Control.MaximumSize properties are respected, but the current value of the Control.Size property is ignored. Using Form.AutoSize and Form.AutoSizeMode also renders the Form.AutoScroll property superfluous, as there is no way to shrink the form to hide its contained controls from view.

See the System.Windows.Forms.AutoSizeMode enumeration for information on how a form behaves when Form.AutoSize is true.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0