Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
6973 lines (6255 sloc) 493 KB
<Type Name="Form" FullName="System.Windows.Forms.Form">
<TypeSignature Language="C#" Value="public class Form : System.Windows.Forms.ContainerControl" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Form extends System.Windows.Forms.ContainerControl" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.Form" />
<TypeSignature Language="VB.NET" Value="Public Class Form&#xA;Inherits ContainerControl" />
<TypeSignature Language="C++ CLI" Value="public ref class Form : System::Windows::Forms::ContainerControl" />
<TypeSignature Language="F#" Value="type Form = class&#xA; inherit ContainerControl" />
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.Forms.ContainerControl</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultEvent("Load")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.ComponentModel.Designer("System.Windows.Forms.Design.FormDocumentDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.ComponentModel.Design.IRootDesigner))</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerCategory("Form")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignTimeVisible(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.InitializationEvent("Load")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.ToolboxItem(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.ToolboxItemFilter("System.Windows.Forms.Control.TopLevel")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.ComponentModel.Designer("System.Windows.Forms.Design.FormDocumentDesigner, System.Design, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.ComponentModel.Design.IRootDesigner))</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName>System.ComponentModel.Designer("System.Windows.Forms.Design.FormDocumentDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.ComponentModel.Design.IRootDesigner))</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a window or dialog box that makes up an application's user interface.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Windows.Forms.Form> is a representation of any window displayed in your application. The <xref:System.Windows.Forms.Form> class can be used to create standard, tool, borderless, and floating windows. You can also use the <xref:System.Windows.Forms.Form> class to create modal windows such as a dialog box. A special kind of form, the multiple-document interface (MDI) form, can contain other forms called MDI child forms. An MDI form is created by setting the <xref:System.Windows.Forms.Form.IsMdiContainer%2A> property to `true`. MDI child forms are created by setting the <xref:System.Windows.Forms.Form.MdiParent%2A> property to the MDI parent form that will contain the child form.
Using the properties available in the <xref:System.Windows.Forms.Form> class, you can determine the appearance, size, color, and window management features of the window or dialog box you are creating. The <xref:System.Windows.Forms.Control.Text%2A> property allows you to specify the caption of the window in the title bar. The <xref:System.Windows.Forms.Form.Size%2A> and <xref:System.Windows.Forms.Form.DesktopLocation%2A> properties allow you to define the size and position of the window when it is displayed. You can use the <xref:System.Windows.Forms.Control.ForeColor%2A> color property to change the default foreground color of all controls placed on the form. The <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, and <xref:System.Windows.Forms.Form.MaximizeBox%2A> properties allow you to control whether the form can be minimized, maximized, or resized at run time.
In addition to properties, you can use the methods of the class to manipulate a form. For example, you can use the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to show a form as a modal dialog box. You can use the <xref:System.Windows.Forms.Form.SetDesktopLocation%2A> method to position the form on the desktop.
The events of the <xref:System.Windows.Forms.Form> class allow you to respond to actions performed on the form. You can use the <xref:System.Windows.Forms.Form.Activated> event to perform operations such as updating the data displayed in the controls of the form when the form is activated.
You can use a form as the starting class in your application by placing a method called `Main` in the class. In the `Main` method add code to create and show the form. You will also need to add the `STAThread` attribute to the `Main` method in order for the form to run. When the starting form is closed, the application is also closed.
If you set the <xref:System.Windows.Forms.Control.Enabled%2A> property to `false` before the <xref:System.Windows.Forms.Form> is visible (for example, setting <xref:System.Windows.Forms.Control.Enabled%2A> to false in the [!INCLUDE[TLA#tla_visualstu](~/includes/tlasharptla-visualstu-md.md)] designer), the minimize, maximize, close, and system buttons remain enabled. If you set <xref:System.Windows.Forms.Control.Enabled%2A> to `false` after the <xref:System.Windows.Forms.Form> is visible (for example, when the Load event occurs), the buttons are disabled.
## Examples
The following code example creates a new instance of a <xref:System.Windows.Forms.Form> and calls the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to display the form as a dialog box. The example sets the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.AcceptButton%2A>, <xref:System.Windows.Forms.Form.CancelButton%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to change the appearance and functionality of the form to a dialog box. The example also uses the <xref:System.Windows.Forms.Form.ControlCollection.Add%2A> method of the form's <xref:System.Windows.Forms.Control.Controls%2A> collection to add two <xref:System.Windows.Forms.Button> controls. The example uses the <xref:System.Windows.Forms.Form.HelpButton%2A> property to display a help button in the caption bar of the dialog box.
[!code-cpp[Classic Form.AcceptButton Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.AcceptButton Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CS/source.cs#1)]
[!code-vb[Classic Form.AcceptButton Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.AcceptButton Example/VB/source.vb#1)]
]]></format>
</remarks>
<related type="Article" href="https://msdn.microsoft.com/library/599faf75-13cf-49cc-ad3c-255545e5cb97">Multiple-Document Interface (MDI) Applications</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Form ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; Form();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Forms.Form" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default size of a form is 300 pixels in height and 300 pixels in width.
## Examples
The following code example creates a new instance of a <xref:System.Windows.Forms.Form> and calls the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to display the form as a dialog box. The example sets the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.AcceptButton%2A>, <xref:System.Windows.Forms.Form.CancelButton%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to change the appearance and functionality of the form to a dialog box. The example also sets uses the <xref:System.Windows.Forms.Form.ControlCollection.Add%2A> method of the form's <xref:System.Windows.Forms.Control.Controls%2A> collection to add two <xref:System.Windows.Forms.Button> controls. The example uses the <xref:System.Windows.Forms.Form.HelpButton%2A> property to display a help button in the caption bar of the dialog box.
[!code-cpp[Classic Form.AcceptButton Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.AcceptButton Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CS/source.cs#1)]
[!code-vb[Classic Form.AcceptButton Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.AcceptButton Example/VB/source.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AcceptButton">
<MemberSignature Language="C#" Value="public System.Windows.Forms.IButtonControl AcceptButton { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Forms.IButtonControl AcceptButton" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AcceptButton" />
<MemberSignature Language="VB.NET" Value="Public Property AcceptButton As IButtonControl" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::IButtonControl ^ AcceptButton { System::Windows::Forms::IButtonControl ^ get(); void set(System::Windows::Forms::IButtonControl ^ value); };" />
<MemberSignature Language="F#" Value="member this.AcceptButton : System.Windows.Forms.IButtonControl with get, set" Usage="System.Windows.Forms.Form.AcceptButton" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.IButtonControl</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the button on the form that is clicked when the user presses the ENTER key.</summary>
<value>An <see cref="T:System.Windows.Forms.IButtonControl" /> that represents the button to use as the accept button for the form.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property enables you to designate a default action to occur when the user presses the ENTER key in your application. The button assigned to this property must be an <xref:System.Windows.Forms.IButtonControl> that is on the current form or located within a container on the current form.
You can use this property to allow the user to quickly navigate a simple form by allowing them to simply press the ENTER key when they are finished instead of manually clicking the accept button with their mouse.
The accept button might not be activated if the currently selected control on the form intercepts the ENTER key and processes it. For example, a multiline text box control allows the ENTER key to be pressed when it is selected to insert a new line character in the control.
## Examples
The following code example creates a new instance of a <xref:System.Windows.Forms.Form> and calls the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to display the form as a dialog box. The example sets the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.AcceptButton%2A>, <xref:System.Windows.Forms.Form.CancelButton%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to change the appearance and functionality of the form to a dialog box. The example also uses the <xref:System.Windows.Forms.Form.ControlCollection.Add%2A> method of the form's <xref:System.Windows.Forms.Control.Controls%2A> collection to add two <xref:System.Windows.Forms.Button> controls. The example uses the <xref:System.Windows.Forms.Form.HelpButton%2A> property to display a help button in the caption bar of the dialog box.
[!code-cpp[Classic Form.AcceptButton Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.AcceptButton Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CS/source.cs#1)]
[!code-vb[Classic Form.AcceptButton Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.AcceptButton Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.CancelButton" />
<altmember cref="T:System.Windows.Forms.IButtonControl" />
</Docs>
</Member>
<Member MemberName="Activate">
<MemberSignature Language="C#" Value="public void Activate ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Activate() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.Activate" />
<MemberSignature Language="VB.NET" Value="Public Sub Activate ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Activate();" />
<MemberSignature Language="F#" Value="member this.Activate : unit -&gt; unit" Usage="form.Activate " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Activates the form and gives it focus.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Activating a form brings it to the front if this is the active application, or it flashes the window caption if this is not the active application. The form must be visible for this method to have any effect. To determine the active form in an application, use the <xref:System.Windows.Forms.Form.ActiveForm%2A> property or the <xref:System.Windows.Forms.Form.ActiveMdiChild%2A> property if your forms are in a Multiple-document interface (MDI) application.
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.Form.SetDesktopLocation%2A>, <xref:System.Windows.Forms.Form.Load> and <xref:System.Windows.Forms.Form.Activate%2A> members. To run the example, paste the following code in a form called `Form1` containing a button called `Button1` and two `Label` controls called `Label1` and `Label2`.
[!code-cpp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp#1)]
[!code-csharp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CS/form1.cs#1)]
[!code-vb[System.Windows.Forms.FormsActivate#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/VB/form1.vb#1)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.UIPermission">for changing focus. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.AllWindows" />.</permission>
<altmember cref="P:System.Windows.Forms.Form.ActiveForm" />
<altmember cref="P:System.Windows.Forms.Form.ActiveMdiChild" />
</Docs>
</Member>
<Member MemberName="Activated">
<MemberSignature Language="C#" Value="public event EventHandler Activated;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Activated" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.Activated" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Activated As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ Activated;" />
<MemberSignature Language="F#" Value="member this.Activated : EventHandler " Usage="member this.Activated : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the form is activated in code or by the user.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!NOTE]
> When the application is active and has multiple forms, the active form is the form with the input focus. A form that is not visible cannot be the active form. The simplest way to activate a visible form is to click it or use an appropriate keyboard combination.
To activate a form at run time using code, call the <xref:System.Windows.Forms.Form.Activate%2A> method. You can use this event for tasks such as updating the contents of the form based on changes made to the form's data when the form was not activated.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.Form.SetDesktopLocation%2A>, <xref:System.Windows.Forms.Form.Closed>, <xref:System.Windows.Forms.Form.Load>, <xref:System.Windows.Forms.Form.Activated>, and <xref:System.Windows.Forms.Form.Activate%2A> members. To run the example, paste the following code in a form called Form1 containing a <xref:System.Windows.Forms.Button> called `Button1` and two <xref:System.Windows.Forms.Label> controls called `Label1` and `Label2`.
[!code-cpp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp#1)]
[!code-csharp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CS/form1.cs#1)]
[!code-vb[System.Windows.Forms.FormsActivate#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/VB/form1.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Windows.Forms.Form.OnActivated(System.EventArgs)" />
</Docs>
</Member>
<Member MemberName="ActivateMdiChild">
<MemberSignature Language="C#" Value="protected void ActivateMdiChild (System.Windows.Forms.Form form);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance void ActivateMdiChild(class System.Windows.Forms.Form form) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.ActivateMdiChild(System.Windows.Forms.Form)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; void ActivateMdiChild(System::Windows::Forms::Form ^ form);" />
<MemberSignature Language="F#" Value="member this.ActivateMdiChild : System.Windows.Forms.Form -&gt; unit" Usage="form.ActivateMdiChild form" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="form" Type="System.Windows.Forms.Form" />
</Parameters>
<Docs>
<param name="form">The child form to activate.</param>
<summary>Activates the MDI child of a form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the `form` parameter is already the active MDI child form, then the <xref:System.Windows.Forms.Form.ActivateMdiChild%2A> method simply returns. If `form` is not `null`, then it is set to be the active MDI child form.
Whether the `form` parameter is `null` or not, <xref:System.Windows.Forms.Form.ActivateMdiChild%2A> raises the <xref:System.Windows.Forms.Form.MdiChildActivate> event.
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.ActiveMdiChild" />
<altmember cref="P:System.Windows.Forms.Form.ActiveForm" />
<altmember cref="E:System.Windows.Forms.Form.MdiChildActivate" />
</Docs>
</Member>
<Member MemberName="ActiveForm">
<MemberSignature Language="C#" Value="public static System.Windows.Forms.Form ActiveForm { get; }" />
<MemberSignature Language="ILAsm" Value=".property class System.Windows.Forms.Form ActiveForm" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.ActiveForm" />
<MemberSignature Language="VB.NET" Value="Public Shared ReadOnly Property ActiveForm As Form" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static property System::Windows::Forms::Form ^ ActiveForm { System::Windows::Forms::Form ^ get(); };" />
<MemberSignature Language="F#" Value="member this.ActiveForm : System.Windows.Forms.Form" Usage="System.Windows.Forms.Form.ActiveForm" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.Form</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the currently active form for this application.</summary>
<value>A <see cref="T:System.Windows.Forms.Form" /> that represents the currently active form, or <see langword="null" /> if there is no active form.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this method to obtain a reference to the currently active form to perform actions on the form or its controls.
If your application is a multiple-document interface (MDI) application, use the <xref:System.Windows.Forms.Form.ActiveMdiChild%2A> property to obtain the currently active MDI child form.
## Examples
The following code example gets the active form and disables all the controls on the form. The example uses the <xref:System.Windows.Forms.Control.Controls%2A> collection of the form to iterate through each control on the form and disable the controls.
[!code-cpp[Classic Form.ActiveForm Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.ActiveForm Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CS/source.cs#1)]
[!code-vb[Classic Form.ActiveForm Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.ActiveForm Example/VB/source.vb#1)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.UIPermission">for requesting a form. Associated enumeration: <see cref="F:System.Security.Permissions.UIPermissionWindow.AllWindows" />.</permission>
<altmember cref="P:System.Windows.Forms.Form.ActiveMdiChild" />
</Docs>
</Member>
<Member MemberName="ActiveMdiChild">
<MemberSignature Language="C#" Value="public System.Windows.Forms.Form ActiveMdiChild { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Forms.Form ActiveMdiChild" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.ActiveMdiChild" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property ActiveMdiChild As Form" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::Form ^ ActiveMdiChild { System::Windows::Forms::Form ^ get(); };" />
<MemberSignature Language="F#" Value="member this.ActiveMdiChild : System.Windows.Forms.Form" Usage="System.Windows.Forms.Form.ActiveMdiChild" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.Form</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the currently active multiple-document interface (MDI) child window.</summary>
<value>Returns a <see cref="T:System.Windows.Forms.Form" /> that represents the currently active MDI child window, or <see langword="null" /> if there are currently no child windows present.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this method to determine whether there are any MDI child forms open in your MDI application. You can also use this method to perform operations on an MDI child window from its MDI parent form or from another form that is displayed in your application.
If the currently active form is not an MDI child form, you can use the <xref:System.Windows.Forms.Form.ActiveForm%2A> property to obtain a reference to it.
## Examples
The following code example obtains a reference to the active MDI child form and loops through all <xref:System.Windows.Forms.TextBox> controls on the form, resetting their <xref:System.Windows.Forms.TextBoxBase.Text%2A> properties. This example requires that an MDI parent form has been created and that this method call is being made from the MDI parent form.
[!code-cpp[Classic Form.ActiveMdiChild Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.ActiveMdiChild Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CS/source.cs#1)]
[!code-vb[Classic Form.ActiveMdiChild Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.ActiveForm" />
</Docs>
</Member>
<Member MemberName="AddOwnedForm">
<MemberSignature Language="C#" Value="public void AddOwnedForm (System.Windows.Forms.Form ownedForm);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddOwnedForm(class System.Windows.Forms.Form ownedForm) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.AddOwnedForm(System.Windows.Forms.Form)" />
<MemberSignature Language="VB.NET" Value="Public Sub AddOwnedForm (ownedForm As Form)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void AddOwnedForm(System::Windows::Forms::Form ^ ownedForm);" />
<MemberSignature Language="F#" Value="member this.AddOwnedForm : System.Windows.Forms.Form -&gt; unit" Usage="form.AddOwnedForm ownedForm" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="ownedForm" Type="System.Windows.Forms.Form" />
</Parameters>
<Docs>
<param name="ownedForm">The <see cref="T:System.Windows.Forms.Form" /> that this form will own.</param>
<summary>Adds an owned form to this form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The form assigned to the owner form remains owned until the <xref:System.Windows.Forms.Form.RemoveOwnedForm%2A> method is called. You can also make a form owned by another by setting the <xref:System.Windows.Forms.Form.Owner%2A> property with a reference to its owner form.
When a form is owned by another form, it is closed or hidden with the owner form. For example, consider a form named `Form2` that is owned by a form named `Form1`. If `Form1` is closed or minimized, `Form2` is also closed or hidden. Owned forms are also never displayed behind their owner form. You can use owned forms for windows such as find and replace windows, which should not be displayed behind the owner form when the owner form is selected.
> [!NOTE]
> If the form is a multiple-document interface (MDI) parent form, this property returns all forms that are displayed with the exception of any MDI child forms that are currently open. To obtain the MDI child forms opened in an MDI parent form, use the <xref:System.Windows.Forms.Form.MdiChildren%2A> property.
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.Form.AddOwnedForm%2A> method to display a form as an owned form of another form. Once the owned form is shown, you can minimize its owner form and the owned form will minimize with it. The example requires that the code in the example is called from another event or method of a form.
[!code-cpp[Form.AddOwnedForm#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp#1)]
[!code-csharp[Form.AddOwnedForm#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Form.AddOwnedForm/CS/form1.cs#1)]
[!code-vb[Form.AddOwnedForm#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Form.AddOwnedForm/VB/form1.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.OwnedForms" />
<altmember cref="M:System.Windows.Forms.Form.RemoveOwnedForm(System.Windows.Forms.Form)" />
<altmember cref="P:System.Windows.Forms.Form.Owner" />
</Docs>
</Member>
<Member MemberName="AdjustFormScrollbars">
<MemberSignature Language="C#" Value="protected override void AdjustFormScrollbars (bool displayScrollbars);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void AdjustFormScrollbars(bool displayScrollbars) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.AdjustFormScrollbars(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub AdjustFormScrollbars (displayScrollbars As Boolean)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void AdjustFormScrollbars(bool displayScrollbars);" />
<MemberSignature Language="F#" Value="override this.AdjustFormScrollbars : bool -&gt; unit" Usage="form.AdjustFormScrollbars displayScrollbars" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="displayScrollbars" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="displayScrollbars">
<see langword="true" /> to show the scroll bars; otherwise, <see langword="false" />.</param>
<summary>Adjusts the scroll bars on the container based on the current control positions and the control currently selected.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="AllowTransparency">
<MemberSignature Language="C#" Value="public bool AllowTransparency { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool AllowTransparency" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AllowTransparency" />
<MemberSignature Language="VB.NET" Value="Public Property AllowTransparency As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool AllowTransparency { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.AllowTransparency : bool with get, set" Usage="System.Windows.Forms.Form.AllowTransparency" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the opacity of the form can be adjusted.</summary>
<value>
<see langword="true" /> if the opacity of the form can be changed; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is automatically set to `true` if the `Opacity` is changed. When the opacity of a form is set using the `Opacity` property, the form will layer objects on the form. If you set the <xref:System.Windows.Forms.Form.AllowTransparency%2A> property to `false` the form will not be in layered mode which will improve the display performance of the form.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="ApplyAutoScaling">
<MemberSignature Language="C#" Value="protected void ApplyAutoScaling ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance void ApplyAutoScaling() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.ApplyAutoScaling" />
<MemberSignature Language="VB.NET" Value="Protected Sub ApplyAutoScaling ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; void ApplyAutoScaling();" />
<MemberSignature Language="F#" Value="member this.ApplyAutoScaling : unit -&gt; unit" Usage="form.ApplyAutoScaling " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.Obsolete("This method has been deprecated. Use the ApplyAutoScaling method instead. http://go.microsoft.com/fwlink/?linkid=14202")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Resizes the form according to the current value of the <see cref="P:System.Windows.Forms.Form.AutoScaleBaseSize" /> property and the size of the current font.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method determines the form size using the value of the <xref:System.Windows.Forms.Form.AutoScaleBaseSize%2A> property and the <xref:System.Windows.Forms.Form.Size%2A> value returned by the <xref:System.Windows.Forms.Form.GetAutoScaleSize%2A> method.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AutoScale">
<MemberSignature Language="C#" Value="public bool AutoScale { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool AutoScale" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AutoScale" />
<MemberSignature Language="VB.NET" Value="Public Property AutoScale As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool AutoScale { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.AutoScale : bool with get, set" Usage="System.Windows.Forms.Form.AutoScale" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.Obsolete("This property has been deprecated. Use the AutoScaleMode property instead. http://go.microsoft.com/fwlink/?linkid=14202")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.ComponentModel.DefaultValue(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the form adjusts its size to fit the height of the font used on the form and scales its controls.</summary>
<value>
<see langword="true" /> if the form will automatically scale itself and its controls based on the current font assigned to the form; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!IMPORTANT]
> The <xref:System.Windows.Forms.Form.AutoScale%2A> is obsolete and has been retained for backward compatibility. The non-obsolete alternative is <xref:System.Windows.Forms.ContainerControl.AutoScaleMode%2A?displayProperty=nameWithType>. For more information about automatic scaling, see [Automatic Scaling in Windows Forms](~/docs/framework/winforms/automatic-scaling-in-windows-forms.md).
You can use this property to allow your form and its controls to automatically adjust based on changes in the font. This can be useful in applications where the font might increase or decrease based on the language specified for use by Windows.
To obtain the size the form will auto scale to, use the <xref:System.Windows.Forms.Form.AutoScaleBaseSize%2A> property. If you want to determine the size the form will auto scale to based on a specific font, use the <xref:System.Windows.Forms.Form.GetAutoScaleSize%2A> method.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AutoScaleBaseSize">
<MemberSignature Language="C#" Value="public virtual System.Drawing.Size AutoScaleBaseSize { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Size AutoScaleBaseSize" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AutoScaleBaseSize" />
<MemberSignature Language="VB.NET" Value="Public Overridable Property AutoScaleBaseSize As Size" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Drawing::Size AutoScaleBaseSize { System::Drawing::Size get(); void set(System::Drawing::Size value); };" />
<MemberSignature Language="F#" Value="member this.AutoScaleBaseSize : System.Drawing.Size with get, set" Usage="System.Windows.Forms.Form.AutoScaleBaseSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>set: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.Size</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the base size used for autoscaling of the form.</summary>
<value>A <see cref="T:System.Drawing.Size" /> that represents the base size that this form uses for autoscaling.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!IMPORTANT]
> This member has been retained for backward compatibility. For more information about automatic scaling, see [Automatic Scaling in Windows Forms](~/docs/framework/winforms/automatic-scaling-in-windows-forms.md).
The value of the <xref:System.Windows.Forms.Form.AutoScaleBaseSize%2A> property is used at form-display time to compute the scaling factor for the form. The autoscaling base size is used by the form as a baseline for comparison to the system's font size to determine how much to scale the form when autoscaling is used. If you want to determine the size a form will auto scale to based on a specific font, use the <xref:System.Windows.Forms.Form.GetAutoScaleSize%2A> method.
> [!NOTE]
> The value of this property is used when the form is initially created. Once the property is set, it cannot be changed.
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.AutoScale" />
<altmember cref="M:System.Windows.Forms.Form.GetAutoScaleSize(System.Drawing.Font)" />
</Docs>
</Member>
<Member MemberName="AutoScroll">
<MemberSignature Language="C#" Value="public override bool AutoScroll { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool AutoScroll" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AutoScroll" />
<MemberSignature Language="VB.NET" Value="Public Overrides Property AutoScroll As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool AutoScroll { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.AutoScroll : bool with get, set" Usage="System.Windows.Forms.Form.AutoScroll" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the form enables autoscrolling.</summary>
<value>
<see langword="true" /> to enable autoscrolling on the form; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If this property is set to `true`, scroll bars are displayed on the form if any controls are located outside the form's client region. Additionally, when autoscrolling is on, the client area of the form automatically scrolls to make the control with input focus visible.
You can use this property to prevent users from losing the ability to view controls when their video resolution settings are set to a low resolution.
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.Form.AutoScroll%2A> property to enable the display of controls that are outsize the client area of a form. The example creates a new form and adds a <xref:System.Windows.Forms.Button> control to the form. The <xref:System.Windows.Forms.Button> control is positioned outsize the client area of the new form. The <xref:System.Windows.Forms.Form.AutoScroll%2A> property is set to true to display scroll bars on the form to enable the user to scroll to the control. This example requires that the method defined in this example is called from another form in an event handler or other method.
[!code-cpp[Form.AutoScroll#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp#1)]
[!code-csharp[Form.AutoScroll#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Form.AutoScroll/CS/form1.cs#1)]
[!code-vb[Form.AutoScroll#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Form.AutoScroll/VB/form1.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AutoSize">
<MemberSignature Language="C#" Value="public override bool AutoSize { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool AutoSize" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AutoSize" />
<MemberSignature Language="VB.NET" Value="Public Overrides Property AutoSize As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property bool AutoSize { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.AutoSize : bool with get, set" Usage="System.Windows.Forms.Form.AutoSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Resize the form according to the setting of <see cref="P:System.Windows.Forms.Form.AutoSizeMode" />.</summary>
<value>
<see langword="true" /> if the form will automatically resize; <see langword="false" /> if it must be manually resized.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use <xref:System.Windows.Forms.Form.AutoSize%2A> 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 <xref:System.Windows.Forms.Form.AutoSize%2A> and <xref:System.Windows.Forms.Form.AutoSizeMode%2A> properties. The form correctly resizes itself at run time according to the values of these two properties. By contrast, a custom <xref:System.Windows.Forms.UserControl> automatically resizes itself both at design time and at run time.
When using <xref:System.Windows.Forms.Form.AutoSize%2A>, the <xref:System.Windows.Forms.Control.MinimumSize%2A> and <xref:System.Windows.Forms.Control.MaximumSize%2A> properties are respected, but the current value of the <xref:System.Windows.Forms.Control.Size%2A> property is ignored. Using <xref:System.Windows.Forms.Form.AutoSize%2A> and <xref:System.Windows.Forms.Form.AutoSizeMode%2A> also renders the <xref:System.Windows.Forms.Form.AutoScroll%2A> property superfluous, as there is no way to shrink the form to hide its contained controls from view.
See the <xref:System.Windows.Forms.AutoSizeMode> enumeration for information on how a form behaves when <xref:System.Windows.Forms.Form.AutoSize%2A> is `true`.
## Examples
The following code example shows a form created using code that automatically resizes to fit its contents. When run, the form displays a <xref:System.Windows.Forms.Label>, a <xref:System.Windows.Forms.TextBox> for entering a URL, and a <xref:System.Windows.Forms.Button> for displaying that URL inside of the user's default Web browser. The code example uses a <xref:System.Windows.Forms.FlowLayoutPanel> to lay out the contained controls one after the other. It also sets the <xref:System.Windows.Forms.Control.AutoSize%2A> and <xref:System.Windows.Forms.AutoSizeMode> to grow and shrink to fit the contents of its form.
[!code-csharp[Form.AutoSize#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Form.AutoSize/CS/Form1.cs#1)]
[!code-vb[Form.AutoSize#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Form.AutoSize/VB/Form1.vb#1)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="AutoSizeChanged">
<MemberSignature Language="C#" Value="public event EventHandler AutoSizeChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler AutoSizeChanged" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.AutoSizeChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event AutoSizeChanged As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ AutoSizeChanged;" />
<MemberSignature Language="F#" Value="member this.AutoSizeChanged : EventHandler " Usage="member this.AutoSizeChanged : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the <see cref="P:System.Windows.Forms.Form.AutoSize" /> property changes.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="AutoSizeMode">
<MemberSignature Language="C#" Value="public System.Windows.Forms.AutoSizeMode AutoSizeMode { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Forms.AutoSizeMode AutoSizeMode" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AutoSizeMode" />
<MemberSignature Language="VB.NET" Value="Public Property AutoSizeMode As AutoSizeMode" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::AutoSizeMode AutoSizeMode { System::Windows::Forms::AutoSizeMode get(); void set(System::Windows::Forms::AutoSizeMode value); };" />
<MemberSignature Language="F#" Value="member this.AutoSizeMode : System.Windows.Forms.AutoSizeMode with get, set" Usage="System.Windows.Forms.Form.AutoSizeMode" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.AutoSizeMode</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the mode by which the form automatically resizes itself.</summary>
<value>An <see cref="T:System.Windows.Forms.AutoSizeMode" /> enumerated value. The default is <see cref="F:System.Windows.Forms.AutoSizeMode.GrowOnly" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Setting the <xref:System.Windows.Forms.Form.AutoSizeMode%2A> property to a new value causes the form to be laid out again.
A form does not automatically resize in the Visual Studio forms designer, regardless of the values of the <xref:System.Windows.Forms.Form.AutoSize%2A> and <xref:System.Windows.Forms.Form.AutoSizeMode%2A> properties. The form correctly resizes itself at run time according to the values of these two properties. By contrast, a custom <xref:System.Windows.Forms.UserControl> automatically resizes itself both at design time and at run time.
## Examples
The following code example shows a form created using code that automatically resizes to fit its contents. When run, the form displays a <xref:System.Windows.Forms.Label>, a <xref:System.Windows.Forms.TextBox> for entering a URL, and a <xref:System.Windows.Forms.Button> for displaying that URL inside of the user's default Web browser. The code example uses a <xref:System.Windows.Forms.FlowLayoutPanel> to lay out the contained controls one after the other. It also sets the <xref:System.Windows.Forms.Control.AutoSize%2A> and <xref:System.Windows.Forms.AutoSizeMode> to grow and shrink to fit the contents of its form.
[!code-csharp[Form.AutoSize#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Form.AutoSize/CS/Form1.cs#1)]
[!code-vb[Form.AutoSize#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Form.AutoSize/VB/Form1.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value is not a valid <see cref="T:System.Windows.Forms.AutoSizeMode" /> value.</exception>
<altmember cref="T:System.Windows.Forms.AutoSizeMode" />
<altmember cref="P:System.Windows.Forms.Form.AutoSize" />
<altmember cref="M:System.Windows.Forms.Form.OnLayout(System.Windows.Forms.LayoutEventArgs)" />
</Docs>
</Member>
<Member MemberName="AutoValidate">
<MemberSignature Language="C#" Value="public override System.Windows.Forms.AutoValidate AutoValidate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Forms.AutoValidate AutoValidate" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.AutoValidate" />
<MemberSignature Language="VB.NET" Value="Public Overrides Property AutoValidate As AutoValidate" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Windows::Forms::AutoValidate AutoValidate { System::Windows::Forms::AutoValidate get(); void set(System::Windows::Forms::AutoValidate value); };" />
<MemberSignature Language="F#" Value="member this.AutoValidate : System.Windows.Forms.AutoValidate with get, set" Usage="System.Windows.Forms.Form.AutoValidate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.AutoValidate</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that indicates whether controls in this container will be automatically validated when the focus changes.</summary>
<value>An <see cref="T:System.Windows.Forms.AutoValidate" /> enumerated value that indicates whether contained controls are implicitly validated on focus change. The default is Inherit.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Windows.Forms.ContainerControl.AutoValidate" />
</Docs>
</Member>
<Member MemberName="AutoValidateChanged">
<MemberSignature Language="C#" Value="public event EventHandler AutoValidateChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler AutoValidateChanged" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.AutoValidateChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event AutoValidateChanged As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ AutoValidateChanged;" />
<MemberSignature Language="F#" Value="member this.AutoValidateChanged : EventHandler " Usage="member this.AutoValidateChanged : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the <see cref="P:System.Windows.Forms.Form.AutoValidate" /> property changes.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="BackColor">
<MemberSignature Language="C#" Value="public override System.Drawing.Color BackColor { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Color BackColor" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.BackColor" />
<MemberSignature Language="VB.NET" Value="Public Overrides Property BackColor As Color" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; virtual property System::Drawing::Color BackColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };" />
<MemberSignature Language="F#" Value="member this.BackColor : System.Drawing.Color with get, set" Usage="System.Windows.Forms.Form.BackColor" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Drawing.Color</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the background color for the control.</summary>
<value>A <see cref="T:System.Drawing.Color" /> that represents the background color of the control. The default is the value of the <see cref="P:System.Windows.Forms.Control.DefaultBackColor" /> property.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Windows.Forms.Control.BackColor" />
</Docs>
</Member>
<Member MemberName="CancelButton">
<MemberSignature Language="C#" Value="public System.Windows.Forms.IButtonControl CancelButton { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Forms.IButtonControl CancelButton" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.CancelButton" />
<MemberSignature Language="VB.NET" Value="Public Property CancelButton As IButtonControl" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::IButtonControl ^ CancelButton { System::Windows::Forms::IButtonControl ^ get(); void set(System::Windows::Forms::IButtonControl ^ value); };" />
<MemberSignature Language="F#" Value="member this.CancelButton : System.Windows.Forms.IButtonControl with get, set" Usage="System.Windows.Forms.Form.CancelButton" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.IButtonControl</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the button control that is clicked when the user presses the ESC key.</summary>
<value>An <see cref="T:System.Windows.Forms.IButtonControl" /> that represents the cancel button for the form.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The cancel button for a form is the button control that is clicked whenever the user presses the ESC key. The button assigned to this property must be an <xref:System.Windows.Forms.IButtonControl> that is on the current form or located within a container on the current form.
This property allows you to designate a default action to occur when the user presses the ESC key in your application. You can use this property to allow the user to quickly navigate a simple form by allowing them to simply press the ESC key to close a window without committing changes instead of manually clicking the cancel button with their mouse.
<xref:System.Windows.Forms.Form.CancelButton%2A> may not work if another control on the form intercepts the ESC key. For example, if you have a <xref:System.Windows.Forms.ComboBox> open on your form, ESC will close the <xref:System.Windows.Forms.ComboBox> instead of closing the Form.
The <xref:System.Windows.Forms.IButtonControl> object assigned to <xref:System.Windows.Forms.Form.CancelButton%2A> must be visible on the form, or else pressing the ESC key will have no effect.
## Examples
The following code example creates a new instance of a <xref:System.Windows.Forms.Form> and calls the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to display the form as a dialog box. The example sets the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.AcceptButton%2A>, <xref:System.Windows.Forms.Form.CancelButton%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to change the appearance and functionality of the form to a dialog box. The example also uses the <xref:System.Windows.Forms.Form.ControlCollection.Add%2A> method of the form's <xref:System.Windows.Forms.Control.Controls%2A> collection to add two <xref:System.Windows.Forms.Button> controls. The example uses the <xref:System.Windows.Forms.Form.HelpButton%2A> property to display a help button in the caption bar of the dialog box.
[!code-cpp[Classic Form.AcceptButton Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.AcceptButton Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CS/source.cs#1)]
[!code-vb[Classic Form.AcceptButton Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.AcceptButton Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.AcceptButton" />
<altmember cref="T:System.Windows.Forms.IButtonControl" />
</Docs>
</Member>
<Member MemberName="CenterToParent">
<MemberSignature Language="C#" Value="protected void CenterToParent ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance void CenterToParent() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.CenterToParent" />
<MemberSignature Language="VB.NET" Value="Protected Sub CenterToParent ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; void CenterToParent();" />
<MemberSignature Language="F#" Value="member this.CenterToParent : unit -&gt; unit" Usage="form.CenterToParent " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Centers the position of the form within the bounds of the parent form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Do not call the <xref:System.Windows.Forms.Form.CenterToParent%2A> method directly from your code. Instead, set the <xref:System.Windows.Forms.Form.StartPosition%2A> property to <xref:System.Windows.Forms.FormStartPosition.CenterParent>.
If the form or dialog is top-level, then <xref:System.Windows.Forms.Form.CenterToParent%2A> centers the form with respect to the screen or desktop.
]]></format>
</remarks>
<altmember cref="F:System.Windows.Forms.FormStartPosition.CenterParent" />
<altmember cref="M:System.Windows.Forms.Form.CenterToScreen" />
</Docs>
</Member>
<Member MemberName="CenterToScreen">
<MemberSignature Language="C#" Value="protected void CenterToScreen ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig instance void CenterToScreen() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.CenterToScreen" />
<MemberSignature Language="VB.NET" Value="Protected Sub CenterToScreen ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; void CenterToScreen();" />
<MemberSignature Language="F#" Value="member this.CenterToScreen : unit -&gt; unit" Usage="form.CenterToScreen " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Centers the form on the current screen.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Do not call this directly from your code. Instead, set the <xref:System.Windows.Forms.Form.StartPosition%2A> property to <xref:System.Windows.Forms.FormStartPosition.CenterScreen>.
The <xref:System.Windows.Forms.Form.CenterToScreen%2A> method uses the following priority list to determine the screen used to center the form:
1. The <xref:System.Windows.Forms.Form.Owner%2A> property of the form.
2. The HWND owner of the form.
3. The screen that currently has the mouse cursor.
]]></format>
</remarks>
<altmember cref="F:System.Windows.Forms.FormStartPosition.CenterScreen" />
<altmember cref="P:System.Windows.Forms.Form.Owner" />
</Docs>
</Member>
<Member MemberName="ClientSize">
<MemberSignature Language="C#" Value="public System.Drawing.Size ClientSize { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Size ClientSize" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.ClientSize" />
<MemberSignature Language="VB.NET" Value="Public Property ClientSize As Size" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Drawing::Size ClientSize { System::Drawing::Size get(); void set(System::Drawing::Size value); };" />
<MemberSignature Language="F#" Value="member this.ClientSize : System.Drawing.Size with get, set" Usage="System.Windows.Forms.Form.ClientSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.Size</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the size of the client area of the form.</summary>
<value>A <see cref="T:System.Drawing.Size" /> that represents the size of the form's client area.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The size of the client area of the form is the size of the form excluding the borders and the title bar. The client area of a form is the area within a form where controls can be placed. You can use this property to get the proper dimensions when performing graphics operations or when sizing and positioning controls on the form. To get the size of the entire form, use the <xref:System.Windows.Forms.Form.Size%2A> property or use the individual properties <xref:System.Windows.Forms.Control.Height%2A> and <xref:System.Windows.Forms.Control.Width%2A>.
> [!NOTE]
> You cannot currently bind to this property using application settings. For more information on application settings, see [Application Settings Overview](~/docs/framework/winforms/advanced/application-settings-overview.md).
## Examples
The following code example creates an event handler for the <xref:System.Windows.Forms.Control.Resize> event of a form. The event handler uses the <xref:System.Windows.Forms.Form.ClientSize%2A> property of the form to make a <xref:System.Windows.Forms.Button> control named `button1` fill the entire client area of the form.
[!code-cpp[Classic Form.ClientSize Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.ClientSize Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CS/source.cs#1)]
[!code-vb[Classic Form.ClientSize Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.ClientSize Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.Size" />
<altmember cref="P:System.Windows.Forms.Control.Height" />
<altmember cref="P:System.Windows.Forms.Control.Width" />
</Docs>
</Member>
<Member MemberName="Close">
<MemberSignature Language="C#" Value="public void Close ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Close() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.Close" />
<MemberSignature Language="VB.NET" Value="Public Sub Close ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Close();" />
<MemberSignature Language="F#" Value="member this.Close : unit -&gt; unit" Usage="form.Close " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Closes the form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When a form is closed, all resources created within the object are closed and the form is disposed. You can prevent the closing of a form at run time by handling the <xref:System.Windows.Forms.Form.Closing> event and setting the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.ComponentModel.CancelEventArgs> passed as a parameter to your event handler. If the form you are closing is the startup form of your application, your application ends.
The two conditions when a form is not disposed on `Close` is when (1) it is part of a multiple-document interface (MDI) application, and the form is not visible; and (2) you have displayed the form using <xref:System.Windows.Forms.Form.ShowDialog%2A>. In these cases, you will need to call <xref:System.Windows.Forms.Form.Dispose%2A> manually to mark all of the form's controls for garbage collection.
> [!NOTE]
> When the <xref:System.Windows.Forms.Form.Close%2A> method is called on a <xref:System.Windows.Forms.Form> displayed as a modeless window, you cannot call the <xref:System.Windows.Forms.Control.Show%2A> method to make the form visible, because the form's resources have already been released. To hide a form and then make it visible, use the <xref:System.Windows.Forms.Control.Hide%2A?displayProperty=nameWithType> method.
> [!CAUTION]
> Prior to the [!INCLUDE[dnprdnshort](~/includes/dnprdnshort-md.md)] 2.0, the <xref:System.Windows.Forms.Form.Closed?displayProperty=nameWithType> and <xref:System.Windows.Forms.Form.Closing?displayProperty=nameWithType> events are not raised when the <xref:System.Windows.Forms.Application.Exit%2A?displayProperty=nameWithType> method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the <xref:System.Windows.Forms.Form.Close%2A?displayProperty=nameWithType> method for each open form individually before calling the <xref:System.Windows.Forms.Application.Exit%2A> method.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The form was closed while a handle was being created.</exception>
<exception cref="T:System.ObjectDisposedException">You cannot call this method from the <see cref="E:System.Windows.Forms.Form.Activated" /> event when <see cref="P:System.Windows.Forms.Form.WindowState" /> is set to <see cref="F:System.Windows.Forms.FormWindowState.Maximized" />.</exception>
<altmember cref="P:System.ComponentModel.CancelEventArgs.Cancel" />
<altmember cref="E:System.Windows.Forms.Form.Closing" />
<altmember cref="T:System.Windows.Forms.CloseReason" />
</Docs>
</Member>
<Member MemberName="Closed">
<MemberSignature Language="C#" Value="public event EventHandler Closed;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Closed" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.Closed" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Closed As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ Closed;" />
<MemberSignature Language="F#" Value="member this.Closed : EventHandler " Usage="member this.Closed : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the form is closed.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!CAUTION]
> The <xref:System.Windows.Forms.Form.Closed> event is obsolete in the .NET Framework version 2.0; use the <xref:System.Windows.Forms.Form.FormClosed> event instead.
This event occurs after the form has been closed by the user or by the <xref:System.Windows.Forms.Form.Close%2A> method of the form. To prevent a form from closing, handle the <xref:System.Windows.Forms.Form.Closing> event and set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.ComponentModel.CancelEventArgs> passed to your event handler to `true`.
You can use this event to perform tasks such as freeing resources used by the form and to save information entered in the form or to update its parent form.
> [!CAUTION]
> The <xref:System.Windows.Forms.Form.Closed?displayProperty=nameWithType> and <xref:System.Windows.Forms.Form.Closing?displayProperty=nameWithType> events are not raised when the <xref:System.Windows.Forms.Application.Exit%2A?displayProperty=nameWithType> method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the <xref:System.Windows.Forms.Form.Close%2A?displayProperty=nameWithType> method for each open form individually before calling the <xref:System.Windows.Forms.Application.Exit%2A> method.
If the form is an MDI parent form, the <xref:System.Windows.Forms.Form.Closing> events of all MDI child forms are raised before the MDI parent form's <xref:System.Windows.Forms.Form.Closing> event is raised. In addition, the <xref:System.Windows.Forms.Form.Closed> events of all MDI child forms are raised before the <xref:System.Windows.Forms.Form.Closed> event of the MDI parent form is raised.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.Form.SetDesktopLocation%2A>, <xref:System.Windows.Forms.Form.Closed>, <xref:System.Windows.Forms.Form.Load>, <xref:System.Windows.Forms.Form.Activated>, and <xref:System.Windows.Forms.Form.Activate%2A> members. To run the example, paste the following code in a form called `Form1` containing a <xref:System.Windows.Forms.Button> called `Button1` and two <xref:System.Windows.Forms.Label> controls called `Label1` and `Label2`.
[!code-cpp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp#1)]
[!code-csharp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CS/form1.cs#1)]
[!code-vb[System.Windows.Forms.FormsActivate#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/VB/form1.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.IsMdiContainer" />
<altmember cref="M:System.Windows.Forms.Form.OnClosed(System.EventArgs)" />
<altmember cref="E:System.Windows.Forms.Form.Load" />
</Docs>
</Member>
<Member MemberName="Closing">
<MemberSignature Language="C#" Value="public event System.ComponentModel.CancelEventHandler Closing;" />
<MemberSignature Language="ILAsm" Value=".event class System.ComponentModel.CancelEventHandler Closing" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.Closing" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Closing As CancelEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::ComponentModel::CancelEventHandler ^ Closing;" />
<MemberSignature Language="F#" Value="member this.Closing : System.ComponentModel.CancelEventHandler " Usage="member this.Closing : System.ComponentModel.CancelEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.ComponentModel.CancelEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the form is closing.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!CAUTION]
> The <xref:System.Windows.Forms.Form.Closing> event is obsolete in the .NET Framework version 2.0; use the <xref:System.Windows.Forms.Form.FormClosing> event instead.
The <xref:System.Windows.Forms.Form.Closing> event occurs as the form is being closed. When a form is closed, all resources created within the object are released and the form is disposed. If you cancel this event, the form remains opened. To cancel the closure of a form, set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.ComponentModel.CancelEventArgs> passed to your event handler to `true`.
When a form is displayed as a modal dialog box, clicking the **Close** button (the button with an X at the upper-right corner of the form) causes the form to be hidden and the <xref:System.Windows.Forms.Form.DialogResult%2A> property to be set to `DialogResult.Cancel`. You can override the value assigned to the <xref:System.Windows.Forms.Form.DialogResult%2A> property when the user clicks the **Close** button by setting the <xref:System.Windows.Forms.Form.DialogResult%2A> property in an event handler for the <xref:System.Windows.Forms.Form.Closing> event of the form.
> [!NOTE]
> When the <xref:System.Windows.Forms.Form.Close%2A> method is called on a <xref:System.Windows.Forms.Form> displayed as a modeless window, you cannot call the <xref:System.Windows.Forms.Control.Show%2A> method to make the form visible, because the form's resources have already been released. To hide a form and then make it visible, use the <xref:System.Windows.Forms.Control.Hide%2A?displayProperty=nameWithType> method.
> [!CAUTION]
> The <xref:System.Windows.Forms.Form.Closed?displayProperty=nameWithType> and <xref:System.Windows.Forms.Form.Closing?displayProperty=nameWithType> events are not raised when the <xref:System.Windows.Forms.Application.Exit%2A?displayProperty=nameWithType> method is called to exit your application. If you have validation code in either of these events that must be executed, you should call the <xref:System.Windows.Forms.Form.Close%2A?displayProperty=nameWithType> method for each open form individually before calling the <xref:System.Windows.Forms.Application.Exit%2A> method.
If the form is an MDI parent form, the <xref:System.Windows.Forms.Form.Closing> events of all MDI child forms are raised before the MDI parent form's <xref:System.Windows.Forms.Form.Closing> event is raised. In addition, the <xref:System.Windows.Forms.Form.Closed> events of all MDI child forms are raised before the <xref:System.Windows.Forms.Form.Closed> event of the MDI parent form is raised. Canceling the <xref:System.Windows.Forms.Form.Closing> event of an MDI child form does not prevent the <xref:System.Windows.Forms.Form.Closing> event of the MDI parent form from being raised. However, canceling the event will set to `true` the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.ComponentModel.CancelEventArgs> that is passed as a parameter to the parent form. To force all MDI parent and child forms to close, set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property to `false` in the MDI parent form.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example uses <xref:System.Windows.Forms.Form.Closing> to test if the text in a <xref:System.Windows.Forms.TextBox> has changed. If it has, the user is asked whether to save the changes to a file.
[!code-cpp[Form.Closing#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp#1)]
[!code-csharp[Form.Closing#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Form.Closing/CS/form1.cs#1)]
[!code-vb[Form.Closing#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Form.Closing/VB/form1.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.IsMdiContainer" />
<altmember cref="M:System.Windows.Forms.Form.OnClosing(System.ComponentModel.CancelEventArgs)" />
</Docs>
</Member>
<Member MemberName="ControlBox">
<MemberSignature Language="C#" Value="public bool ControlBox { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool ControlBox" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.ControlBox" />
<MemberSignature Language="VB.NET" Value="Public Property ControlBox As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool ControlBox { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.ControlBox : bool with get, set" Usage="System.Windows.Forms.Form.ControlBox" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether a control box is displayed in the caption bar of the form.</summary>
<value>
<see langword="true" /> if the form displays a control box in the upper-right corner of the form; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the <xref:System.Windows.Forms.Form.ControlBox%2A> property is set to `true`, the control box is displayed in the upper-right corner of the caption bar. The control box can include minimize, maximize, and help buttons in addition to a close button. For the `ControlBox` property to have any effect, you must also set the form's <xref:System.Windows.Forms.Form.FormBorderStyle%2A> property to <xref:System.Windows.Forms.FormBorderStyle.FixedSingle?displayProperty=nameWithType>, <xref:System.Windows.Forms.FormBorderStyle.Sizable?displayProperty=nameWithType>, <xref:System.Windows.Forms.FormBorderStyle.Fixed3D?displayProperty=nameWithType>, or <xref:System.Windows.Forms.FormBorderStyle.FixedDialog?displayProperty=nameWithType>.
If you set <xref:System.Windows.Forms.Form.ControlBox%2A> to `false` and also set the <xref:System.Windows.Forms.Form.Location%2A> property, the <xref:System.Windows.Forms.Form.Size%2A> property of the form is not updated to reflect that the non-client area of the form has been hidden. To fix this problem, put the code that alters the <xref:System.Windows.Forms.Form.Location%2A> property in the <xref:System.Windows.Forms.Control.HandleCreated> event handler.
> [!NOTE]
> When set to `false`, the <xref:System.Windows.Forms.Form.ControlBox%2A> property has no effect on a Multiple-document interface (MDI) child form that is displayed maximized at time of creation.
## Examples
The following code example uses the <xref:System.Windows.Forms.Form.ControlBox%2A>, <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to create a form that does not have any border or caption box. The form created in this example could be used to create a splash screen for an application. The example requires that the example's method is defined in a form class and called when the form is being initialized.
[!code-cpp[Classic Form.ControlBox Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.ControlBox Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CS/source.cs#1)]
[!code-vb[Classic Form.ControlBox Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.ControlBox Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.MaximizeBox" />
<altmember cref="P:System.Windows.Forms.Form.MinimizeBox" />
<altmember cref="P:System.Windows.Forms.Form.ShowIcon" />
<altmember cref="P:System.Windows.Forms.Form.FormBorderStyle" />
<altmember cref="P:System.Windows.Forms.Form.WindowState" />
</Docs>
</Member>
<Member MemberName="CreateControlsInstance">
<MemberSignature Language="C#" Value="protected override System.Windows.Forms.Control.ControlCollection CreateControlsInstance ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance class System.Windows.Forms.Control/ControlCollection CreateControlsInstance() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.CreateControlsInstance" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function CreateControlsInstance () As Control.ControlCollection" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Windows::Forms::Control::ControlCollection ^ CreateControlsInstance();" />
<MemberSignature Language="F#" Value="override this.CreateControlsInstance : unit -&gt; System.Windows.Forms.Control.ControlCollection" Usage="form.CreateControlsInstance " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.Control+ControlCollection</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates a new instance of the control collection for the control.</summary>
<returns>A new instance of <see cref="T:System.Windows.Forms.Control.ControlCollection" /> assigned to the control.</returns>
<remarks>To be added.</remarks>
<altmember cref="M:System.Windows.Forms.Control.CreateControlsInstance" />
</Docs>
</Member>
<Member MemberName="CreateHandle">
<MemberSignature Language="C#" Value="protected override void CreateHandle ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void CreateHandle() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.CreateHandle" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub CreateHandle ()" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void CreateHandle();" />
<MemberSignature Language="F#" Value="override this.CreateHandle : unit -&gt; unit" Usage="form.CreateHandle " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates the handle for the form. If a derived class overrides this function, it must call the base implementation.</summary>
<remarks>To be added.</remarks>
<exception cref="T:System.InvalidOperationException">A handle for this <see cref="T:System.Windows.Forms.Form" /> has already been created.</exception>
<altmember cref="M:System.Windows.Forms.Control.CreateHandle" />
</Docs>
</Member>
<Member MemberName="CreateParams">
<MemberSignature Language="C#" Value="protected override System.Windows.Forms.CreateParams CreateParams { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Forms.CreateParams CreateParams" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.CreateParams" />
<MemberSignature Language="VB.NET" Value="Protected Overrides ReadOnly Property CreateParams As CreateParams" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual property System::Windows::Forms::CreateParams ^ CreateParams { System::Windows::Forms::CreateParams ^ get(); };" />
<MemberSignature Language="F#" Value="member this.CreateParams : System.Windows.Forms.CreateParams" Usage="System.Windows.Forms.Form.CreateParams" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.CreateParams</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the required creation parameters when the control handle is created.</summary>
<value>A <see cref="T:System.Windows.Forms.CreateParams" /> that contains the required creation parameters when the handle to the control is created.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Windows.Forms.ContainerControl.CreateParams" />
</Docs>
</Member>
<Member MemberName="Deactivate">
<MemberSignature Language="C#" Value="public event EventHandler Deactivate;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Deactivate" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.Deactivate" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Deactivate As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ Deactivate;" />
<MemberSignature Language="F#" Value="member this.Deactivate : EventHandler " Usage="member this.Deactivate : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the form loses focus and is no longer the active form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this event to perform tasks such as updating another window in your application with data from the deactivated form.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.Form.Deactivate> event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=nameWithType> with <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> or appending the message to a multiline <xref:System.Windows.Forms.TextBox>.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.Form> named `Form1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.Form.Deactivate> event.
[!code-csharp[System.Windows.Forms.EventExamples#393](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/CS/EventExamples.cs#393)]
[!code-vb[System.Windows.Forms.EventExamples#393](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb#393)]
]]></format>
</remarks>
<altmember cref="E:System.Windows.Forms.Form.Activated" />
<altmember cref="M:System.Windows.Forms.Form.Activate" />
<altmember cref="M:System.Windows.Forms.Form.OnDeactivate(System.EventArgs)" />
</Docs>
</Member>
<Member MemberName="DefaultImeMode">
<MemberSignature Language="C#" Value="protected override System.Windows.Forms.ImeMode DefaultImeMode { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Forms.ImeMode DefaultImeMode" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.DefaultImeMode" />
<MemberSignature Language="VB.NET" Value="Protected Overrides ReadOnly Property DefaultImeMode As ImeMode" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual property System::Windows::Forms::ImeMode DefaultImeMode { System::Windows::Forms::ImeMode get(); };" />
<MemberSignature Language="F#" Value="member this.DefaultImeMode : System.Windows.Forms.ImeMode" Usage="System.Windows.Forms.Form.DefaultImeMode" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.ImeMode</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the default Input Method Editor (IME) mode supported by the control.</summary>
<value>One of the <see cref="T:System.Windows.Forms.ImeMode" /> values.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An input method editor (IME) is a program that allows users to enter complex characters and symbols, such as Japanese Kanji characters, by using a standard keyboard.
As implemented in the <xref:System.Windows.Forms.Form> class, this property always returns the <xref:System.Windows.Forms.ImeMode.NoControl?displayProperty=nameWithType> value. The value of this property is assigned to the <xref:System.Windows.Forms.Control.ImeMode%2A?displayProperty=nameWithType> property.
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.ImeMode" />
</Docs>
</Member>
<Member MemberName="DefaultSize">
<MemberSignature Language="C#" Value="protected override System.Drawing.Size DefaultSize { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Size DefaultSize" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.DefaultSize" />
<MemberSignature Language="VB.NET" Value="Protected Overrides ReadOnly Property DefaultSize As Size" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; virtual property System::Drawing::Size DefaultSize { System::Drawing::Size get(); };" />
<MemberSignature Language="F#" Value="member this.DefaultSize : System.Drawing.Size" Usage="System.Windows.Forms.Form.DefaultSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Drawing.Size</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the default size of the control.</summary>
<value>The default <see cref="T:System.Drawing.Size" /> of the control.</value>
<remarks>To be added.</remarks>
<altmember cref="P:System.Windows.Forms.Control.DefaultSize" />
</Docs>
</Member>
<Member MemberName="DefWndProc">
<MemberSignature Language="C#" Value="protected override void DefWndProc (ref System.Windows.Forms.Message m);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void DefWndProc(valuetype System.Windows.Forms.Message&amp; m) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.DefWndProc(System.Windows.Forms.Message@)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub DefWndProc (ByRef m As Message)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void DefWndProc(System::Windows::Forms::Message % m);" />
<MemberSignature Language="F#" Value="override this.DefWndProc : -&gt; unit" Usage="form.DefWndProc m" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="m" Type="System.Windows.Forms.Message" RefType="ref" />
</Parameters>
<Docs>
<param name="m">The Windows <see cref="T:System.Windows.Forms.Message" /> to process.</param>
<summary>Sends the specified message to the default window procedure.</summary>
<remarks>To be added.</remarks>
<altmember cref="M:System.Windows.Forms.Control.DefWndProc(System.Windows.Forms.Message@)" />
</Docs>
</Member>
<Member MemberName="DesktopBounds">
<MemberSignature Language="C#" Value="public System.Drawing.Rectangle DesktopBounds { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Rectangle DesktopBounds" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.DesktopBounds" />
<MemberSignature Language="VB.NET" Value="Public Property DesktopBounds As Rectangle" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Drawing::Rectangle DesktopBounds { System::Drawing::Rectangle get(); void set(System::Drawing::Rectangle value); };" />
<MemberSignature Language="F#" Value="member this.DesktopBounds : System.Drawing.Rectangle with get, set" Usage="System.Windows.Forms.Form.DesktopBounds" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.Rectangle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the size and location of the form on the Windows desktop.</summary>
<value>A <see cref="T:System.Drawing.Rectangle" /> that represents the bounds of the form on the Windows desktop using desktop coordinates.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Desktop coordinates are based on the working area of the screen, which excludes the taskbar. The coordinate system of the desktop is pixel-based. If your application is running on a multiple monitor system, the coordinates of the form are the coordinates for the combined desktop.
You can use this property to size and position a form relative to other forms or applications on the Windows desktop.
## Examples
The following code example sets the size and position of a form so that the form is positioned 50 pixels from the left border of the desktop and 50 pixels from the top of the desktop. This example requires that the method is defined within a form class.
[!code-cpp[Classic Form.DesktopBounds Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.DesktopBounds Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CS/source.cs#1)]
[!code-vb[Classic Form.DesktopBounds Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.DesktopLocation" />
</Docs>
</Member>
<Member MemberName="DesktopLocation">
<MemberSignature Language="C#" Value="public System.Drawing.Point DesktopLocation { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Point DesktopLocation" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.DesktopLocation" />
<MemberSignature Language="VB.NET" Value="Public Property DesktopLocation As Point" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Drawing::Point DesktopLocation { System::Drawing::Point get(); void set(System::Drawing::Point value); };" />
<MemberSignature Language="F#" Value="member this.DesktopLocation : System.Drawing.Point with get, set" Usage="System.Windows.Forms.Form.DesktopLocation" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.Point</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the location of the form on the Windows desktop.</summary>
<value>A <see cref="T:System.Drawing.Point" /> that represents the location of the form on the desktop.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Desktop coordinates are based on the working area of the screen, which excludes the taskbar. The coordinate system of the desktop is pixel based. If your application is running on a multimonitor system, the coordinates of the form are the coordinates for the combined desktop.
You can use this property to position your form relative to other forms and applications on the Windows desktop.
If you call the <xref:System.Windows.Forms.Form.SetDesktopLocation%2A> method before calling the <xref:System.Windows.Forms.Form.Show%2A> method, your form will be positioned at its default location, which is determined by the operating system. For more information about window positioning, see the "Window Size and Position" section of the "Window Features" document in the MSDN library at http://msdn.microsoft.com/library.
If you call <xref:System.Windows.Forms.Form.SetDesktopLocation%2A> after calling <xref:System.Windows.Forms.Form.Show%2A>, your form will be positioned at the location you specified.
## Examples
The following code example sets the position of a form so that the form is positioned 100 pixels from the left border of the desktop and 100 pixels from the top of the desktop. This example requires that method has been defined within a form class.
[!code-cpp[Classic Form.DesktopLocation Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.DesktopLocation Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CS/source.cs#1)]
[!code-vb[Classic Form.DesktopLocation Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.DesktopBounds" />
</Docs>
</Member>
<Member MemberName="DialogResult">
<MemberSignature Language="C#" Value="public System.Windows.Forms.DialogResult DialogResult { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Forms.DialogResult DialogResult" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.DialogResult" />
<MemberSignature Language="VB.NET" Value="Public Property DialogResult As DialogResult" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::DialogResult DialogResult { System::Windows::Forms::DialogResult get(); void set(System::Windows::Forms::DialogResult value); };" />
<MemberSignature Language="F#" Value="member this.DialogResult : System.Windows.Forms.DialogResult with get, set" Usage="System.Windows.Forms.Form.DialogResult" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.DialogResult</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the dialog result for the form.</summary>
<value>A <see cref="T:System.Windows.Forms.DialogResult" /> that represents the result of the form when used as a dialog box.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The dialog result of a form is the value that is returned from the form when it is displayed as a modal dialog box. If the form is displayed as a dialog box, setting this property with a value from the <xref:System.Windows.Forms.DialogResult> enumeration sets the value of the dialog box result for the form, hides the modal dialog box, and returns control to the calling form. This property is typically set by the <xref:System.Windows.Forms.Button.DialogResult%2A> property of a <xref:System.Windows.Forms.Button> control on the form. When the user clicks the <xref:System.Windows.Forms.Button> control, the value assigned to the <xref:System.Windows.Forms.Button.DialogResult%2A> property of the <xref:System.Windows.Forms.Button> is assigned to the <xref:System.Windows.Forms.Form.DialogResult%2A> property of the form.
When a form is displayed as a modal dialog box, clicking the **Close** button (the button with an X in the top-right corner of the form) causes the form to be hidden and the <xref:System.Windows.Forms.Form.DialogResult%2A> property to be set to `DialogResult.Cancel`. The <xref:System.Windows.Forms.Form.Close%2A> method is not automatically called when the user clicks the **Close** button of a dialog box or sets the value of the <xref:System.Windows.Forms.Form.DialogResult%2A> property. Instead, the form is hidden and can be shown again without creating a new instance of the dialog box. Because of this behavior, you must call the <xref:System.Windows.Forms.Control.Dispose%2A> method of the form when the form is no longer needed by your application.
You can use this property to determine how a dialog box is closed in order to properly process the actions performed in the dialog box.
> [!NOTE]
> You can override the value assigned to the <xref:System.Windows.Forms.Form.DialogResult%2A> property when the user clicks the **Close** button by setting the <xref:System.Windows.Forms.Form.DialogResult%2A> property in an event handler for the <xref:System.Windows.Forms.Form.Closing> event of the form.
> [!NOTE]
> If a <xref:System.Windows.Forms.Form> is displayed as a modeless window, the value returned by the <xref:System.Windows.Forms.Form.DialogResult%2A> property might not return a value assigned to the form because the form's resources are automatically released when the form is closed.
## Examples
The following code example displays a form as a dialog box and displays a message box indicating whether the OK or Cancel button of the form was clicked by referencing the <xref:System.Windows.Forms.Form.DialogResult%2A> property of the form.
[!code-cpp[Classic Form.DialogResult Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.DialogResult Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CS/source.cs#1)]
[!code-vb[Classic Form.DialogResult Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.DialogResult Example/VB/source.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception>
<altmember cref="T:System.Windows.Forms.DialogResult" />
<altmember cref="P:System.Windows.Forms.Button.DialogResult" />
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.Dispose(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub Dispose (disposing As Boolean)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void Dispose(bool disposing);" />
<MemberSignature Language="F#" Value="override this.Dispose : bool -&gt; unit" Usage="form.Dispose disposing" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="disposing">
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param>
<summary>Disposes of the resources (other than memory) used by the <see cref="T:System.Windows.Forms.Form" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is called by the public `Dispose` method and the <xref:System.Object.Finalize%2A> method. `Dispose` invokes the protected `Dispose(Boolean)` method with the `disposing` parameter set to `true`. <xref:System.Object.Finalize%2A> invokes `Dispose` with `disposing` set to `false`.
When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this <xref:System.Windows.Forms.Form> references. This method invokes the `Dispose` method of each referenced object.
<xref:System.Windows.Forms.Form.Dispose%2A> will be called automatically if the form is shown using the <xref:System.Windows.Forms.Form.Show%2A> method. If another method such as <xref:System.Windows.Forms.Form.ShowDialog%2A> is used, or the form is never shown at all, you must call <xref:System.Windows.Forms.Form.Dispose%2A> yourself within your application.
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>
<see langword="Dispose" /> can be called multiple times by other objects. When overriding <see langword="Dispose(Boolean)" />, be careful not to reference objects that have been previously disposed of in an earlier call to <see langword="Dispose" />. For more information about how to implement <see langword="Dispose(Boolean)" />, see [Implementing a Dispose Method](~/docs/standard/garbage-collection/implementing-dispose.md).
For more information about <see langword="Dispose" /> and <see cref="M:System.Object.Finalize" />, see [Cleaning Up Unmanaged Resources](~/docs/standard/garbage-collection/unmanaged.md) and [Overriding the Finalize Method](https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ddae83kx(v=vs.100)).</para>
</block>
</Docs>
</Member>
<Member MemberName="DpiChanged">
<MemberSignature Language="C#" Value="public event System.Windows.Forms.DpiChangedEventHandler DpiChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Forms.DpiChangedEventHandler DpiChanged" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.DpiChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event DpiChanged As DpiChangedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::Windows::Forms::DpiChangedEventHandler ^ DpiChanged;" />
<MemberSignature Language="F#" Value="member this.DpiChanged : System.Windows.Forms.DpiChangedEventHandler " Usage="member this.DpiChanged : System.Windows.Forms.DpiChangedEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.DpiChangedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the DPI setting changes on the display device where the form is currently displayed.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="FormBorderStyle">
<MemberSignature Language="C#" Value="public System.Windows.Forms.FormBorderStyle FormBorderStyle { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Forms.FormBorderStyle FormBorderStyle" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.FormBorderStyle" />
<MemberSignature Language="VB.NET" Value="Public Property FormBorderStyle As FormBorderStyle" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::FormBorderStyle FormBorderStyle { System::Windows::Forms::FormBorderStyle get(); void set(System::Windows::Forms::FormBorderStyle value); };" />
<MemberSignature Language="F#" Value="member this.FormBorderStyle : System.Windows.Forms.FormBorderStyle with get, set" Usage="System.Windows.Forms.Form.FormBorderStyle" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Runtime.InteropServices.DispId(-504)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.FormBorderStyle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the border style of the form.</summary>
<value>A <see cref="T:System.Windows.Forms.FormBorderStyle" /> that represents the style of border to display for the form. The default is <see langword="FormBorderStyle.Sizable" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The border style of the form determines how the outer edge of the form appears. In addition to changing the border display for a form, certain border styles prevent the form from being sized. For example, the `FormBorderStyle.FixedDialog` border style changes the border of the form to that of a dialog box and prevents the form from being resized. The border style can also affect the size or availability of the caption bar section of a form.
> [!NOTE]
> With the <xref:System.Windows.Forms.FormBorderStyle.Sizable> style, it is impossible to resize the window below a certain minimum value, even if you have set <xref:System.Windows.Forms.Form.ControlBox%2A> to `false` and assigned a zero-length string to <xref:System.Windows.Forms.Form.Text%2A>. Consider working around this by using the <xref:System.Windows.Forms.FormBorderStyle.SizableToolWindow> style instead.
## Examples
The following code example creates a new instance of a <xref:System.Windows.Forms.Form> and calls the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to display the form as a dialog box. The example sets the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.AcceptButton%2A>, <xref:System.Windows.Forms.Form.CancelButton%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to change the appearance and functionality of the form to a dialog box. The example also uses the <xref:System.Windows.Forms.Form.ControlCollection.Add%2A> method of the form's <xref:System.Windows.Forms.Control.Controls%2A> collection to add two <xref:System.Windows.Forms.Button> controls. The example uses the <xref:System.Windows.Forms.Form.HelpButton%2A> property to display a help button in the caption bar of the dialog box.
[!code-cpp[Classic Form.AcceptButton Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.AcceptButton Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CS/source.cs#1)]
[!code-vb[Classic Form.AcceptButton Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.AcceptButton Example/VB/source.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception>
<altmember cref="T:System.Windows.Forms.FormBorderStyle" />
</Docs>
</Member>
<Member MemberName="FormClosed">
<MemberSignature Language="C#" Value="public event System.Windows.Forms.FormClosedEventHandler FormClosed;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Forms.FormClosedEventHandler FormClosed" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.FormClosed" />
<MemberSignature Language="VB.NET" Value="Public Custom Event FormClosed As FormClosedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::Windows::Forms::FormClosedEventHandler ^ FormClosed;" />
<MemberSignature Language="F#" Value="member this.FormClosed : System.Windows.Forms.FormClosedEventHandler " Usage="member this.FormClosed : System.Windows.Forms.FormClosedEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.FormClosedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after the form is closed.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.Form.FormClosed> event occurs after the form has been closed by the user or by the <xref:System.Windows.Forms.Form.Close%2A> method or the <xref:System.Windows.Forms.Application.Exit%2A> method of the <xref:System.Windows.Forms.Application> class. To prevent a form from closing, handle the <xref:System.Windows.Forms.Form.FormClosing> event and set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.ComponentModel.CancelEventArgs> passed to your event handler to `true`.
You can use this event to perform tasks such as freeing resources used by the form and to save information entered in the form or to update its parent form.
If the form is a multiple-document interface (MDI) parent form, the <xref:System.Windows.Forms.Form.FormClosing> events of all MDI child forms are raised before the MDI parent form's <xref:System.Windows.Forms.Form.FormClosing> event is raised. Likewise, the <xref:System.Windows.Forms.Form.FormClosed> events of all MDI child forms are raised before the <xref:System.Windows.Forms.Form.FormClosed> event of the MDI parent form is raised.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.Form.FormClosed> event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=nameWithType> with <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> or appending the message to a multiline <xref:System.Windows.Forms.TextBox>.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.Form> named `Form1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.Form.FormClosed> event.
[!code-csharp[System.Windows.Forms.EventExamples#395](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/CS/EventExamples.cs#395)]
[!code-vb[System.Windows.Forms.EventExamples#395](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb#395)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.IsMdiContainer" />
<altmember cref="M:System.Windows.Forms.Form.OnFormClosed(System.Windows.Forms.FormClosedEventArgs)" />
<altmember cref="M:System.Windows.Forms.Form.Close" />
<altmember cref="M:System.Windows.Forms.Application.Exit" />
<altmember cref="M:System.Windows.Forms.Control.Hide" />
<altmember cref="E:System.Windows.Forms.Form.FormClosing" />
<altmember cref="E:System.Windows.Forms.Form.Load" />
<altmember cref="E:System.Windows.Forms.Form.Shown" />
<altmember cref="T:System.Windows.Forms.CloseReason" />
</Docs>
</Member>
<Member MemberName="FormClosing">
<MemberSignature Language="C#" Value="public event System.Windows.Forms.FormClosingEventHandler FormClosing;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Forms.FormClosingEventHandler FormClosing" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.FormClosing" />
<MemberSignature Language="VB.NET" Value="Public Custom Event FormClosing As FormClosingEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::Windows::Forms::FormClosingEventHandler ^ FormClosing;" />
<MemberSignature Language="F#" Value="member this.FormClosing : System.Windows.Forms.FormClosingEventHandler " Usage="member this.FormClosing : System.Windows.Forms.FormClosingEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.FormClosingEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs before the form is closed.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.Form.FormClosing> event occurs as the form is being closed. When a form is closed, it is disposed, releasing all resources associated with the form. If you cancel this event, the form remains opened. To cancel the closure of a form, set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.Windows.Forms.FormClosingEventArgs> passed to your event handler to `true`.
When a form is displayed as a modal dialog box, clicking the **Close** button (the button with an X at the upper-right corner of the form) causes the form to be hidden and the <xref:System.Windows.Forms.Form.DialogResult%2A> property to be set to `DialogResult.Cancel`. You can override the value assigned to the <xref:System.Windows.Forms.Form.DialogResult%2A> property when the user clicks the **Close** button by setting the <xref:System.Windows.Forms.Form.DialogResult%2A> property in an event handler for the <xref:System.Windows.Forms.Form.FormClosing> event of the form.
> [!NOTE]
> When the <xref:System.Windows.Forms.Form.Close%2A> method is called on a <xref:System.Windows.Forms.Form> displayed as a modeless window, you cannot call the <xref:System.Windows.Forms.Control.Show%2A> method to make the form visible, because the form's resources have already been released. To hide a form and then make it visible, use the <xref:System.Windows.Forms.Control.Hide%2A> method.
If the form is a multiple-document interface (MDI) parent form, the <xref:System.Windows.Forms.Form.FormClosing> events of all MDI child forms are raised before the MDI parent form's <xref:System.Windows.Forms.Form.FormClosing> event is raised. Likewise, the <xref:System.Windows.Forms.Form.FormClosed> events of all MDI child forms are raised before the <xref:System.Windows.Forms.Form.FormClosed> event of the MDI parent form is raised. Canceling the <xref:System.Windows.Forms.Form.FormClosing> event of an MDI child form does not prevent the <xref:System.Windows.Forms.Form.FormClosing> event of the MDI parent form from being raised. However, canceling the event will set to `true` the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.Windows.Forms.FormClosingEventArgs> class that is passed as a parameter to the parent form. To force all MDI parent and child forms to close, set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property to `false` in the MDI parent form.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.Form.FormClosing> event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=nameWithType> with <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> or appending the message to a multiline <xref:System.Windows.Forms.TextBox>.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.Form> named `Form1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.Form.FormClosing> event.
[!code-csharp[System.Windows.Forms.EventExamples#394](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/CS/EventExamples.cs#394)]
[!code-vb[System.Windows.Forms.EventExamples#394](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb#394)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.IsMdiContainer" />
<altmember cref="M:System.Windows.Forms.Form.Close" />
<altmember cref="M:System.Windows.Forms.Control.Hide" />
<altmember cref="M:System.Windows.Forms.Form.OnFormClosing(System.Windows.Forms.FormClosingEventArgs)" />
<altmember cref="E:System.Windows.Forms.Form.FormClosed" />
<altmember cref="E:System.Windows.Forms.Form.Load" />
<altmember cref="E:System.Windows.Forms.Form.Shown" />
<altmember cref="T:System.Windows.Forms.CloseReason" />
</Docs>
</Member>
<Member MemberName="GetAutoScaleSize">
<MemberSignature Language="C#" Value="public static System.Drawing.SizeF GetAutoScaleSize (System.Drawing.Font font);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig valuetype System.Drawing.SizeF GetAutoScaleSize(class System.Drawing.Font font) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.GetAutoScaleSize(System.Drawing.Font)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static System::Drawing::SizeF GetAutoScaleSize(System::Drawing::Font ^ font);" />
<MemberSignature Language="F#" Value="static member GetAutoScaleSize : System.Drawing.Font -&gt; System.Drawing.SizeF" Usage="System.Windows.Forms.Form.GetAutoScaleSize font" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.Obsolete("This method has been deprecated. Use the AutoScaleDimensions property instead. http://go.microsoft.com/fwlink/?linkid=14202")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-1.1">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.SizeF</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="font" Type="System.Drawing.Font" />
</Parameters>
<Docs>
<param name="font">A <see cref="T:System.Drawing.Font" /> representing the font to determine the autoscaled base size of the form.</param>
<summary>Gets the size when autoscaling the form based on a specified font.</summary>
<returns>A <see cref="T:System.Drawing.SizeF" /> representing the autoscaled size of the form.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
> [!IMPORTANT]
> The <xref:System.Windows.Forms.Form.GetAutoScaleSize%2A> method is obsolete in.NET Framework version 2.0. This member has been retained for backward compatibility. For more information about automatic scaling, see [Automatic Scaling in Windows Forms](~/docs/framework/winforms/automatic-scaling-in-windows-forms.md).
You can use this method to determine the size a form would autoscale to for a specific font before applying the font to the form. If you want to determine the size a form is autoscaled to based on the font currently assigned to the form, use the <xref:System.Windows.Forms.Form.AutoScaleBaseSize%2A> property.
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.AutoScaleBaseSize" />
</Docs>
</Member>
<Member MemberName="GetScaledBounds">
<MemberSignature Language="C#" Value="protected override System.Drawing.Rectangle GetScaledBounds (System.Drawing.Rectangle bounds, System.Drawing.SizeF factor, System.Windows.Forms.BoundsSpecified specified);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance valuetype System.Drawing.Rectangle GetScaledBounds(valuetype System.Drawing.Rectangle bounds, valuetype System.Drawing.SizeF factor, valuetype System.Windows.Forms.BoundsSpecified specified) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.GetScaledBounds(System.Drawing.Rectangle,System.Drawing.SizeF,System.Windows.Forms.BoundsSpecified)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Function GetScaledBounds (bounds As Rectangle, factor As SizeF, specified As BoundsSpecified) As Rectangle" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override System::Drawing::Rectangle GetScaledBounds(System::Drawing::Rectangle bounds, System::Drawing::SizeF factor, System::Windows::Forms::BoundsSpecified specified);" />
<MemberSignature Language="F#" Value="override this.GetScaledBounds : System.Drawing.Rectangle * System.Drawing.SizeF * System.Windows.Forms.BoundsSpecified -&gt; System.Drawing.Rectangle" Usage="form.GetScaledBounds (bounds, factor, specified)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.Rectangle</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="bounds" Type="System.Drawing.Rectangle" Index="0" FrameworkAlternate="netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8" />
<Parameter Name="factor" Type="System.Drawing.SizeF" Index="1" FrameworkAlternate="netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8" />
<Parameter Name="specified" Type="System.Windows.Forms.BoundsSpecified" Index="2" FrameworkAlternate="netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8" />
</Parameters>
<Docs>
<param name="bounds">A <see cref="T:System.Drawing.Rectangle" /> that specifies the area for which to retrieve the display bounds.</param>
<param name="factor">The height and width of the control's bounds.</param>
<param name="specified">One of the values of <see cref="T:System.Windows.Forms.BoundsSpecified" /> that specifies the bounds of the control to use when defining its size and position.</param>
<summary>Retrieves the bounds within which the control is scaled.</summary>
<returns>A <see cref="T:System.Drawing.Rectangle" /> representing the bounds within which the control is scaled.</returns>
<remarks>To be added.</remarks>
<altmember cref="M:System.Windows.Forms.Control.GetScaledBounds(System.Drawing.Rectangle,System.Drawing.SizeF,System.Windows.Forms.BoundsSpecified)" />
</Docs>
</Member>
<Member MemberName="HelpButton">
<MemberSignature Language="C#" Value="public bool HelpButton { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool HelpButton" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.HelpButton" />
<MemberSignature Language="VB.NET" Value="Public Property HelpButton As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool HelpButton { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.HelpButton : bool with get, set" Usage="System.Windows.Forms.Form.HelpButton" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether a Help button should be displayed in the caption box of the form.</summary>
<value>
<see langword="true" /> to display a Help button in the form's caption bar; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When this property is set to `true`, a small button with a question mark appears in the caption bar to the left of the **Close** button. You can use this button to display help for your application. You can create an event handler for the <xref:System.Windows.Forms.Control.HelpRequested> event to display Help information to the user when the Help button of the form is clicked.
To display a Help button, the value of the form's <xref:System.Windows.Forms.Form.ControlBox> property must be `true`, its default value. The <xref:System.Windows.Forms.Form.ControlBox> property determines whether the upper-right corner of the caption bar contains controls such as a maximize button, a minimize button, a help button, and a close button. In addition, you must also set the form's <xref:System.Windows.Forms.Form.FormBorderStyle%2A> property to <xref:System.Windows.Forms.FormBorderStyle.FixedSingle?displayProperty=nameWithType>, <xref:System.Windows.Forms.FormBorderStyle.Sizable?displayProperty=nameWithType>, <xref:System.Windows.Forms.FormBorderStyle.Fixed3D?displayProperty=nameWithType>, or <xref:System.Windows.Forms.FormBorderStyle.FixedDialog?displayProperty=nameWithType>.
> [!IMPORTANT]
> The value of the <xref:System.Windows.Forms.Form.HelpButton%2A> property is ignored if the **Maximize** or **Minimize** buttons are shown.
## Examples
The following code example creates a new instance of a <xref:System.Windows.Forms.Form> and calls the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to display the form as a dialog box. The example sets the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.AcceptButton%2A>, <xref:System.Windows.Forms.Form.CancelButton%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to change the appearance and functionality of the form to a dialog box. The example also uses the <xref:System.Windows.Forms.Form.ControlCollection.Add%2A> method of the form's <xref:System.Windows.Forms.Control.Controls%2A> collection to add two <xref:System.Windows.Forms.Button> controls. The example uses the <xref:System.Windows.Forms.Form.HelpButton%2A> property to display a Help button in the caption bar of the dialog box.
[!code-cpp[Classic Form.AcceptButton Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.AcceptButton Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CS/source.cs#1)]
[!code-vb[Classic Form.AcceptButton Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.AcceptButton Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.MinimizeBox" />
<altmember cref="P:System.Windows.Forms.Form.MaximizeBox" />
<altmember cref="P:System.Windows.Forms.Form.ControlBox" />
<altmember cref="E:System.Windows.Forms.Form.HelpButtonClicked" />
</Docs>
</Member>
<Member MemberName="HelpButtonClicked">
<MemberSignature Language="C#" Value="public event System.ComponentModel.CancelEventHandler HelpButtonClicked;" />
<MemberSignature Language="ILAsm" Value=".event class System.ComponentModel.CancelEventHandler HelpButtonClicked" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.HelpButtonClicked" />
<MemberSignature Language="VB.NET" Value="Public Custom Event HelpButtonClicked As CancelEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::ComponentModel::CancelEventHandler ^ HelpButtonClicked;" />
<MemberSignature Language="F#" Value="member this.HelpButtonClicked : System.ComponentModel.CancelEventHandler " Usage="member this.HelpButtonClicked : System.ComponentModel.CancelEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.ComponentModel.CancelEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the **Help** button is clicked.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.Form.HelpButtonClicked> event occurs when the **Help** button in the form's caption bar is clicked. The **Help** button is displayed when the <xref:System.Windows.Forms.Form.HelpButton%2A> property is set to `true`. <xref:System.Windows.Forms.Form.HelpButtonClicked> can be canceled.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.Form.HelpButtonClicked> event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=nameWithType> with <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> or appending the message to a multiline <xref:System.Windows.Forms.TextBox>.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.Form> named `Form1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.Form.HelpButtonClicked> event.
[!code-csharp[System.Windows.Forms.EventExamples#388](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/CS/EventExamples.cs#388)]
[!code-vb[System.Windows.Forms.EventExamples#388](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb#388)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.HelpButton" />
<altmember cref="P:System.Windows.Forms.Form.ControlBox" />
<altmember cref="M:System.Windows.Forms.Form.OnHelpButtonClicked(System.ComponentModel.CancelEventArgs)" />
<altmember cref="E:System.Windows.Forms.Control.HelpRequested" />
</Docs>
</Member>
<Member MemberName="Icon">
<MemberSignature Language="C#" Value="public System.Drawing.Icon Icon { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Drawing.Icon Icon" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.Icon" />
<MemberSignature Language="VB.NET" Value="Public Property Icon As Icon" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Drawing::Icon ^ Icon { System::Drawing::Icon ^ get(); void set(System::Drawing::Icon ^ value); };" />
<MemberSignature Language="F#" Value="member this.Icon : System.Drawing.Icon with get, set" Usage="System.Windows.Forms.Form.Icon" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.AmbientValue(null)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.Icon</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the icon for the form.</summary>
<value>An <see cref="T:System.Drawing.Icon" /> that represents the icon for the form.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A form's icon designates the picture that represents the form in the taskbar as well as the icon that is displayed for the control box of the form.
This property will have no effect if <xref:System.Windows.Forms.Form.FormBorderStyle%2A> is set to <xref:System.Windows.Forms.FormBorderStyle.FixedDialog>. In that case, the form will not display an icon.
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.ControlBox" />
</Docs>
</Member>
<Member MemberName="InputLanguageChanged">
<MemberSignature Language="C#" Value="public event System.Windows.Forms.InputLanguageChangedEventHandler InputLanguageChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Forms.InputLanguageChangedEventHandler InputLanguageChanged" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.InputLanguageChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event InputLanguageChanged As InputLanguageChangedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::Windows::Forms::InputLanguageChangedEventHandler ^ InputLanguageChanged;" />
<MemberSignature Language="F#" Value="member this.InputLanguageChanged : System.Windows.Forms.InputLanguageChangedEventHandler " Usage="member this.InputLanguageChanged : System.Windows.Forms.InputLanguageChangedEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.InputLanguageChangedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs after the input language of the form has changed.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this event to make changes to your form's appearance and text based on changes made to the input language of the form.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.Form.InputLanguageChanged> event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=nameWithType> with <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> or appending the message to a multiline <xref:System.Windows.Forms.TextBox>.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.Form> named `Form1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.Form.InputLanguageChanged> event.
[!code-csharp[System.Windows.Forms.EventExamples#400](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/CS/EventExamples.cs#400)]
[!code-vb[System.Windows.Forms.EventExamples#400](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb#400)]
]]></format>
</remarks>
<altmember cref="E:System.Windows.Forms.Form.InputLanguageChanging" />
<altmember cref="M:System.Windows.Forms.Form.OnInputLanguageChanged(System.Windows.Forms.InputLanguageChangedEventArgs)" />
</Docs>
</Member>
<Member MemberName="InputLanguageChanging">
<MemberSignature Language="C#" Value="public event System.Windows.Forms.InputLanguageChangingEventHandler InputLanguageChanging;" />
<MemberSignature Language="ILAsm" Value=".event class System.Windows.Forms.InputLanguageChangingEventHandler InputLanguageChanging" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.InputLanguageChanging" />
<MemberSignature Language="VB.NET" Value="Public Custom Event InputLanguageChanging As InputLanguageChangingEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::Windows::Forms::InputLanguageChangingEventHandler ^ InputLanguageChanging;" />
<MemberSignature Language="F#" Value="member this.InputLanguageChanging : System.Windows.Forms.InputLanguageChangingEventHandler " Usage="member this.InputLanguageChanging : System.Windows.Forms.InputLanguageChangingEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.InputLanguageChangingEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the user attempts to change the input language for the form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This event occurs before the change of input language is made for the form. You can cancel the language change by setting the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A> property of the <xref:System.Windows.Forms.InputLanguageChangingEventArgs> passed to your event handler to `false`. If the event is canceled, the input language is not changed. You can use this event to determine whether the requested input language change is appropriate for your application.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.Form.InputLanguageChanging> event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=nameWithType> with <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> or appending the message to a multiline <xref:System.Windows.Forms.TextBox>.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.Form> named `Form1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.Form.InputLanguageChanging> event.
[!code-csharp[System.Windows.Forms.EventExamples#401](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/CS/EventExamples.cs#401)]
[!code-vb[System.Windows.Forms.EventExamples#401](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb#401)]
]]></format>
</remarks>
<altmember cref="E:System.Windows.Forms.Form.InputLanguageChanged" />
<altmember cref="M:System.Windows.Forms.Form.OnInputLanguageChanging(System.Windows.Forms.InputLanguageChangingEventArgs)" />
</Docs>
</Member>
<Member MemberName="IsMdiChild">
<MemberSignature Language="C#" Value="public bool IsMdiChild { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsMdiChild" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.IsMdiChild" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property IsMdiChild As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool IsMdiChild { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsMdiChild : bool" Usage="System.Windows.Forms.Form.IsMdiChild" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the form is a multiple-document interface (MDI) child form.</summary>
<value>
<see langword="true" /> if the form is an MDI child form; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
At run time, MDI child forms are displayed inside the client area of an MDI parent form. An MDI child form can be maximized, minimized, and moved within the MDI parent form. To create an MDI child form, assign the <xref:System.Windows.Forms.Form> that will be the MDI parent form to the <xref:System.Windows.Forms.Form.MdiParent%2A> property of the child form. You can use the <xref:System.Windows.Forms.Form.IsMdiContainer%2A> property to determine whether a form is an MDI parent form.
You can use the <xref:System.Windows.Forms.Form.IsMdiChild%2A> property to determine whether a form returned by a method or property is an MDI child form or a standard form in your application such as a dialog box.
> [!NOTE]
> All MDI child forms have sizable borders, a control-menu box, and Minimize and **Maximize** buttons, regardless of the settings of the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.ControlBox%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, and <xref:System.Windows.Forms.Form.MaximizeBox%2A> properties.
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.MdiParent" />
<altmember cref="P:System.Windows.Forms.Form.MdiChildren" />
<altmember cref="P:System.Windows.Forms.Form.IsMdiContainer" />
</Docs>
</Member>
<Member MemberName="IsMdiContainer">
<MemberSignature Language="C#" Value="public bool IsMdiContainer { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsMdiContainer" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.IsMdiContainer" />
<MemberSignature Language="VB.NET" Value="Public Property IsMdiContainer As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool IsMdiContainer { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.IsMdiContainer : bool with get, set" Usage="System.Windows.Forms.Form.IsMdiContainer" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the form is a container for multiple-document interface (MDI) child forms.</summary>
<value>
<see langword="true" /> if the form is a container for MDI child forms; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property changes the display and behavior of the form to an MDI parent form. When this property is set to `true`, the form displays a sunken client area with a raised border. All MDI child forms assigned to the parent form are displayed within its client area.
When an MDI parent form is closed, the <xref:System.Windows.Forms.Form.Closing> events of all MDI child forms are raised before the MDI parent form's <xref:System.Windows.Forms.Form.Closing> event is raised. In addition, the <xref:System.Windows.Forms.Form.Closed> events of all MDI child forms are raised before the <xref:System.Windows.Forms.Form.Closed> event of the MDI parent form is raised.
> [!NOTE]
> If there are two <xref:System.Windows.Forms.MenuStrip> controls on an MDI child form, setting <xref:System.Windows.Forms.Form.IsMdiContainer%2A> to `true` for the parent form merges the contents of only one of the <xref:System.Windows.Forms.MenuStrip> controls. Use <xref:System.Windows.Forms.ToolStripManager.Merge%2A> to merge the contents of additional child <xref:System.Windows.Forms.MenuStrip> controls on the MDI parent form.
## Examples
The following code example demonstrates using the <xref:System.Windows.Forms.Form.IsMdiContainer%2A> property as well as changing the `BackColor` property of an MDI Form. To run this example, paste the following code in a new form.
[!code-csharp[System.Windows.Forms.MdiClientExample#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.MdiClientExample/CS/form1.cs#1)]
[!code-vb[System.Windows.Forms.MdiClientExample#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.MdiClientExample/VB/form1.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.IsMdiChild" />
<altmember cref="P:System.Windows.Forms.Form.MdiParent" />
<altmember cref="P:System.Windows.Forms.Form.MdiChildren" />
</Docs>
</Member>
<Member MemberName="IsRestrictedWindow">
<MemberSignature Language="C#" Value="public bool IsRestrictedWindow { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsRestrictedWindow" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.IsRestrictedWindow" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property IsRestrictedWindow As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool IsRestrictedWindow { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsRestrictedWindow : bool" Usage="System.Windows.Forms.Form.IsRestrictedWindow" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the form can use all windows and user input events without restriction.</summary>
<value>
<see langword="true" /> if the form has restrictions; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.Form.IsRestrictedWindow%2A> property determines whether the <xref:System.Security.Permissions.UIPermissionWindow.AllWindows> permission is granted. This property is set at run time in the form's constructor, and is cached for the lifetime of the form. Windows Forms applications running in partial trust cannot circumvent this check, as the common language runtime ensures that the parent constructor is always called in partial trust.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="KeyPreview">
<MemberSignature Language="C#" Value="public bool KeyPreview { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool KeyPreview" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.KeyPreview" />
<MemberSignature Language="VB.NET" Value="Public Property KeyPreview As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool KeyPreview { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.KeyPreview : bool with get, set" Usage="System.Windows.Forms.Form.KeyPreview" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the form will receive key events before the event is passed to the control that has focus.</summary>
<value>
<see langword="true" /> if the form will receive all key events; <see langword="false" /> if the currently selected control on the form receives key events. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When this property is set to `true`, the form will receive all <xref:System.Windows.Forms.Control.KeyPress>, <xref:System.Windows.Forms.Control.KeyDown>, and <xref:System.Windows.Forms.Control.KeyUp> events. After the form's event handlers have completed processing the keystroke, the keystroke is then assigned to the control with focus. For example, if the <xref:System.Windows.Forms.Form.KeyPreview%2A> property is set to `true` and the currently selected control is a <xref:System.Windows.Forms.TextBox>, after the keystroke is handled by the event handlers of the form the <xref:System.Windows.Forms.TextBox> control will receive the key that was pressed. To handle keyboard events only at the form level and not allow controls to receive keyboard events, set the <xref:System.Windows.Forms.KeyPressEventArgs.Handled%2A?displayProperty=nameWithType> property in your form's <xref:System.Windows.Forms.Control.KeyPress> event handler to `true`.
You can use this property to process most keystrokes in your application and either handle the keystroke or call the appropriate control to handle the keystroke. For example, when an application uses function keys, you might want to process the keystrokes at the form level rather than writing code for each control that might receive keystroke events.
> [!NOTE]
> If a form has no visible or enabled controls, it automatically receives all keyboard events.
> [!NOTE]
> A control on a form may be programmed to cancel any keystrokes it receives. Since the control never sends these keystrokes to the form, the form will never see them regardless of the setting of <xref:System.Windows.Forms.Form.KeyPreview%2A>.
## Examples
The following code example demonstrates setting a form's <xref:System.Windows.Forms.Form.KeyPreview%2A> property to true and handling the key events at the form level. To run the example, paste the following code in a blank form.
[!code-cpp[System.Windows.Forms.ProcessMnemonic#2](~/samples/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp#2)]
[!code-csharp[System.Windows.Forms.ProcessMnemonic#2](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CS/form1.cs#2)]
[!code-vb[System.Windows.Forms.ProcessMnemonic#2](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/VB/form1.vb#2)]
]]></format>
</remarks>
<altmember cref="E:System.Windows.Forms.Control.KeyPress" />
<altmember cref="E:System.Windows.Forms.Control.KeyDown" />
<altmember cref="E:System.Windows.Forms.Control.KeyUp" />
</Docs>
</Member>
<Member MemberName="LayoutMdi">
<MemberSignature Language="C#" Value="public void LayoutMdi (System.Windows.Forms.MdiLayout value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void LayoutMdi(valuetype System.Windows.Forms.MdiLayout value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Form.LayoutMdi(System.Windows.Forms.MdiLayout)" />
<MemberSignature Language="VB.NET" Value="Public Sub LayoutMdi (value As MdiLayout)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void LayoutMdi(System::Windows::Forms::MdiLayout value);" />
<MemberSignature Language="F#" Value="member this.LayoutMdi : System.Windows.Forms.MdiLayout -&gt; unit" Usage="form.LayoutMdi value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Windows.Forms.MdiLayout" />
</Parameters>
<Docs>
<param name="value">One of the <see cref="T:System.Windows.Forms.MdiLayout" /> values that defines the layout of MDI child forms.</param>
<summary>Arranges the multiple-document interface (MDI) child forms within the MDI parent form.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this method to arrange the MDI child forms in your MDI parent form to allow for easier navigation and manipulation of MDI child forms. MDI child forms can be tiled horizontally and vertically, cascaded, or as icons within the MDI parent form.
## Examples
The following code example shows the event handlers for the menu items of a Window menu in an MDI application's parent form. Each event handler makes calls to the <xref:System.Windows.Forms.Form.LayoutMdi%2A> method to arrange any child forms that are currently open in the application.
[!code-cpp[Classic Form.LayoutMdi Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.LayoutMdi Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CS/source.cs#1)]
[!code-vb[Classic Form.LayoutMdi Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.MdiLayout" />
</Docs>
</Member>
<Member MemberName="Load">
<MemberSignature Language="C#" Value="public event EventHandler Load;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler Load" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.Load" />
<MemberSignature Language="VB.NET" Value="Public Custom Event Load As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ Load;" />
<MemberSignature Language="F#" Value="member this.Load : EventHandler " Usage="member this.Load : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs before a form is displayed for the first time.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this event to perform tasks such as allocating resources used by the form.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.Form.SetDesktopLocation%2A>, <xref:System.Windows.Forms.Form.Load>, <xref:System.Windows.Forms.Form.Activated>, and <xref:System.Windows.Forms.Form.Activate%2A> members. To run the example, paste the following code in a form called `Form1` containing a <xref:System.Windows.Forms.Button> called `Button1` and two <xref:System.Windows.Forms.Label> controls called `Label1` and `Label2`.
[!code-cpp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp#1)]
[!code-csharp[System.Windows.Forms.FormsActivate#1](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CS/form1.cs#1)]
[!code-vb[System.Windows.Forms.FormsActivate#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/VB/form1.vb#1)]
]]></format>
</remarks>
<altmember cref="M:System.Windows.Forms.Form.OnLoad(System.EventArgs)" />
<altmember cref="M:System.Windows.Forms.Form.Close" />
</Docs>
</Member>
<Member MemberName="Location">
<MemberSignature Language="C#" Value="public System.Drawing.Point Location { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Point Location" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.Location" />
<MemberSignature Language="VB.NET" Value="Public Property Location As Point" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Drawing::Point Location { System::Drawing::Point get(); void set(System::Drawing::Point value); };" />
<MemberSignature Language="F#" Value="member this.Location : System.Drawing.Point with get, set" Usage="System.Windows.Forms.Form.Location" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.SettingsBindable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Drawing.Point</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the <see cref="T:System.Drawing.Point" /> that represents the upper-left corner of the <see cref="T:System.Windows.Forms.Form" /> in screen coordinates.</summary>
<value>The <see cref="T:System.Drawing.Point" /> that represents the upper-left corner of the <see cref="T:System.Windows.Forms.Form" /> in screen coordinates.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
<xref:System.Drawing.Point> is a structure, which means that it is a value type. If you access a property in <xref:System.Drawing.Point>, a copy of the property is returned. Therefore, changing the <xref:System.Drawing.Point.X%2A> or <xref:System.Drawing.Point.Y%2A> properties of the <xref:System.Drawing.Point> returned from the <xref:System.Windows.Forms.Control.Location%2A> property will not affect the <xref:System.Windows.Forms.Control.Left%2A>, <xref:System.Windows.Forms.Control.Right%2A>, <xref:System.Windows.Forms.Control.Top%2A>, or <xref:System.Windows.Forms.Control.Bottom%2A> property values of the <xref:System.Windows.Forms.Form>. To adjust these properties, set each property value individually, or set the <xref:System.Windows.Forms.Form.Location%2A> property with a new <xref:System.Drawing.Point>.
The <xref:System.Windows.Forms.Form.Location%2A> property gets or sets the <xref:System.Windows.Forms.Control.Location%2A> property of the <xref:System.Windows.Forms.Control> base class, and sets the <xref:System.ComponentModel.SettingsBindableAttribute.Bindable%2A> property to `true`.
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.Form" />
<altmember cref="T:System.Windows.Forms.ContainerControl" />
<altmember cref="P:System.Windows.Forms.Control.Location" />
</Docs>
</Member>
<Member MemberName="MainMenuStrip">
<MemberSignature Language="C#" Value="public System.Windows.Forms.MenuStrip MainMenuStrip { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Forms.MenuStrip MainMenuStrip" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.MainMenuStrip" />
<MemberSignature Language="VB.NET" Value="Public Property MainMenuStrip As MenuStrip" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::MenuStrip ^ MainMenuStrip { System::Windows::Forms::MenuStrip ^ get(); void set(System::Windows::Forms::MenuStrip ^ value); };" />
<MemberSignature Language="F#" Value="member this.MainMenuStrip : System.Windows.Forms.MenuStrip with get, set" Usage="System.Windows.Forms.Form.MainMenuStrip" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.DefaultValue(null)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.TypeConverter(typeof(System.ComponentModel.ReferenceConverter))</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.MenuStrip</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the primary menu container for the form.</summary>
<value>A <see cref="T:System.Windows.Forms.MenuStrip" /> that represents the container for the menu structure of the form. The default is <see langword="null" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
In addition to setting the <xref:System.Windows.Forms.Form.MainMenuStrip%2A> property, you must <xref:System.Windows.Forms.Control.ControlCollection.Add%2A> the <xref:System.Windows.Forms.MenuStrip> control to the <xref:System.Windows.Forms.Control.Controls%2A> collection of the form.
The <xref:System.Windows.Forms.MenuStrip> class supersedes the <xref:System.Windows.Forms.MainMenu> class in previous versions of the .NET Framework.
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.MenuStrip" />
<altmember cref="P:System.Windows.Forms.Control.Controls" />
</Docs>
</Member>
<Member MemberName="Margin">
<MemberSignature Language="C#" Value="public System.Windows.Forms.Padding Margin { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Forms.Padding Margin" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.Margin" />
<MemberSignature Language="VB.NET" Value="Public Property Margin As Padding" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Windows::Forms::Padding Margin { System::Windows::Forms::Padding get(); void set(System::Windows::Forms::Padding value); };" />
<MemberSignature Language="F#" Value="member this.Margin : System.Windows.Forms.Padding with get, set" Usage="System.Windows.Forms.Form.Margin" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.Padding</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the space between controls.</summary>
<value>A value that represents the space between controls.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="MarginChanged">
<MemberSignature Language="C#" Value="public event EventHandler MarginChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler MarginChanged" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.MarginChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event MarginChanged As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ MarginChanged;" />
<MemberSignature Language="F#" Value="member this.MarginChanged : EventHandler " Usage="member this.MarginChanged : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netcore-3.0">
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the <see cref="P:System.Windows.Forms.Form.Margin" /> property changes.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="MaximizeBox">
<MemberSignature Language="C#" Value="public bool MaximizeBox { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool MaximizeBox" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.MaximizeBox" />
<MemberSignature Language="VB.NET" Value="Public Property MaximizeBox As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool MaximizeBox { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.MaximizeBox : bool with get, set" Usage="System.Windows.Forms.Form.MaximizeBox" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the **Maximize** button is displayed in the caption bar of the form.</summary>
<value>
<see langword="true" /> to display a **Maximize** button for the form; otherwise, <see langword="false" />. The default is <see langword="true" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A **Maximize** button enables users to enlarge a window to full-screen size. To display a **Maximize** button, the value of the form's <xref:System.Windows.Forms.Form.ControlBox> property must be `true`, its default value. The <xref:System.Windows.Forms.Form.ControlBox> property determines whether the upper-right corner of the caption bar contains controls such as a maximize button, a minimize button, a help button, and a close button. In addition, you must also set the form's <xref:System.Windows.Forms.Form.FormBorderStyle%2A> property to <xref:System.Windows.Forms.FormBorderStyle.FixedSingle?displayProperty=nameWithType>, <xref:System.Windows.Forms.FormBorderStyle.Sizable?displayProperty=nameWithType>, <xref:System.Windows.Forms.FormBorderStyle.Fixed3D?displayProperty=nameWithType>, or <xref:System.Windows.Forms.FormBorderStyle.FixedDialog?displayProperty=nameWithType>.
A **Maximize** button automatically becomes a restore button when a window is maximized. Minimizing or restoring a window automatically changes the restore button back to a **Maximize** button.
> [!NOTE]
> Maximizing a form at run time generates a <xref:System.Windows.Forms.Control.Resize> event. The <xref:System.Windows.Forms.Form.WindowState%2A> property reflects the current state of the window. If you set the <xref:System.Windows.Forms.Form.WindowState%2A> property to `FormWindowState.Maximized`, the form is maximized independently of whatever settings are in effect for the <xref:System.Windows.Forms.Form.MaximizeBox%2A> and <xref:System.Windows.Forms.Form.FormBorderStyle%2A> properties.
## Examples
The following code example creates a new instance of a <xref:System.Windows.Forms.Form> and calls the <xref:System.Windows.Forms.Form.ShowDialog%2A> method to display the form as a dialog box. The example sets the <xref:System.Windows.Forms.Form.FormBorderStyle%2A>, <xref:System.Windows.Forms.Form.AcceptButton%2A>, <xref:System.Windows.Forms.Form.CancelButton%2A>, <xref:System.Windows.Forms.Form.MinimizeBox%2A>, <xref:System.Windows.Forms.Form.MaximizeBox%2A>, and <xref:System.Windows.Forms.Form.StartPosition%2A> properties to change the appearance and functionality of the form to a dialog box. The example also uses the <xref:System.Windows.Forms.Form.ControlCollection.Add%2A> method of the form's <xref:System.Windows.Forms.Control.Controls%2A> collection to add two <xref:System.Windows.Forms.Button> controls. The example uses the <xref:System.Windows.Forms.Form.HelpButton%2A> property to display a help button in the caption bar of the dialog box.
[!code-cpp[Classic Form.AcceptButton Example#1](~/samples/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp#1)]
[!code-csharp[Classic Form.AcceptButton Example#1](~/samples/snippets/csharp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CS/source.cs#1)]
[!code-vb[Classic Form.AcceptButton Example#1](~/samples/snippets/visualbasic/VS_Snippets_Winforms/Classic Form.AcceptButton Example/VB/source.vb#1)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.MinimizeBox" />
<altmember cref="P:System.Windows.Forms.Form.ControlBox" />
</Docs>
</Member>
<Member MemberName="MaximizedBounds">
<MemberSignature Language="C#" Value="protected System.Drawing.Rectangle MaximizedBounds { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Drawing.Rectangle MaximizedBounds" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.Form.MaximizedBounds" />
<MemberSignature Language="VB.NET" Value="Protected Property MaximizedBounds As Rectangle" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; property System::Drawing::Rectangle MaximizedBounds { System::Drawing::Rectangle get(); void set(System::Drawing::Rectangle value); };" />
<MemberSignature Language="F#" Value="member this.MaximizedBounds : System.Drawing.Rectangle with get, set" Usage="System.Windows.Forms.Form.MaximizedBounds" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Drawing.Rectangle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the size of the form when it is maximized.</summary>
<value>A <see cref="T:System.Drawing.Rectangle" /> that represents the bounds of the form when it is maximized.</value>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The value of the <see cref="P:System.Drawing.Rectangle.Top" /> property is greater than the height of the form.
-or-
The value of the <see cref="P:System.Drawing.Rectangle.Left" /> property is greater than the width of the form.</exception>
<block subset="none" type="overrides">
<para>Classes that inherit from <see cref="T:System.Windows.Forms.Form" /> can override this method to provide new bounds for the form when it is maximized. The class sets this property internally when the form's **Maximize** button is clicked.</para>
</block>
<altmember cref="P:System.Windows.Forms.Form.MaximumSize" />
<altmember cref="P:System.Windows.Forms.Form.MinimumSize" />
</Docs>
</Member>
<Member MemberName="MaximizedBoundsChanged">
<MemberSignature Language="C#" Value="public event EventHandler MaximizedBoundsChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.EventHandler MaximizedBoundsChanged" />
<MemberSignature Language="DocId" Value="E:System.Windows.Forms.Form.MaximizedBoundsChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event MaximizedBoundsChanged As EventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event EventHandler ^ MaximizedBoundsChanged;" />
<MemberSignature Language="F#" Value="member this.MaximizedBoundsChanged : EventHandler " Usage="member this.MaximizedBoundsChanged : System.EventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Occurs when the value of the <see cref="P:System.Windows.Forms.Form.MaximizedBounds" /> property has changed.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
The following code example demonstrates the use of this member. In the example, an event handler reports on the occurrence of the <xref:System.Windows.Forms.Form.MaximizedBoundsChanged> event. This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing <xref:System.Windows.Forms.MessageBox.Show%2A?displayProperty=nameWithType> with <xref:System.Console.WriteLine%2A?displayProperty=nameWithType> or appending the message to a multiline <xref:System.Windows.Forms.TextBox>.
To run the example code, paste it into a project that contains an instance of type <xref:System.Windows.Forms.Form> named `Form1`. Then ensure that the event handler is associated with the <xref:System.Windows.Forms.Form.MaximizedBoundsChanged> event.
[!code-csharp[System.Windows.Forms.EventExamples#389](~/samples/snippets/csharp/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/CS/EventExamples.cs#389)]
[!code-vb[System.Windows.Forms.EventExamples#389](~/samples/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.EventExamples/VB/EventExamples.vb#389)]
]]></format>
</remarks>
<altmember cref="P:System.Windows.Forms.Form.MaximizedBounds" />
<altmember cref="M:System.Windows.Forms.Form.OnMaximizedBoundsChanged(System.EventArgs)" />
</Docs>
</Member>
<Member MemberName="MaximumSize">
<MemberSignature Language="