Form.MaximumSize 属性

定义

获取窗体可调整到的最大大小。Gets the maximum size the form can be resized to.

public:
 property System::Drawing::Size MaximumSize { System::Drawing::Size get(); void set(System::Drawing::Size value); };
public System.Drawing.Size MaximumSize { get; set; }
member this.MaximumSize : System.Drawing.Size with get, set
Public Property MaximumSize As Size

属性值

Size,表示该窗体的最大大小。A Size that represents the maximum size for the form.

异常

Size 对象内的高或宽的值小于零。The values of the height or width within the Size object are less than zero.

示例

下面的示例演示如何设置 MaximumSize 属性。The following example demonstrates setting the MaximumSize property.

public:
   Form1()
      : Form()
   {
      
      //This call is required by the Windows Form Designer.
      InitializeComponent();
      
      //Set the maximum size, so if user maximizes form, it 
      //will not cover entire desktop.  
      this->MaximumSize = System::Drawing::Size( 500, 500 );
   }
public Form1() : base()
{        

    //This call is required by the Windows Form Designer.
    InitializeComponent();

    //Set the maximum size, so if user maximizes form, it 
    //will not cover entire desktop.  
    this.MaximumSize = new System.Drawing.Size(500, 500);


}
Public Sub New()
    MyBase.New()

    'This call is required by the Windows Form Designer.
    InitializeComponent()

    'Set the maximum size, so if user maximizes form, it 
    'will not cover entire desktop.  
    Me.MaximumSize = New Size(500, 500)


End Sub

注解

使用此属性可以将窗体的大小限制为指定的最大大小。This property enables you to limit the size of a form to a specified maximum size. 如果同时显示多个窗口,则可以使用此功能,以确保单个窗口不会导致隐藏其他窗口。You can use this feature when displaying multiple windows at the same time, to ensure that a single window does not cause other windows to be hidden. 如果将此属性设置为高度为0的 Size 对象(宽度为0),则窗体将不会超过 Windows 设置的限制。If this property is set to a Size object that is 0 in height and 0 in width, the form will have no maximum size beyond the limits set by Windows.

适用于

另请参阅