共用方式為


Form.MaximumSize 屬性

定義

取得表單所能調整的大小上限。

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

屬性值

Size,代表表單的大小上限。

例外狀況

Size 物件內的高度或寬度值小於零。

範例

下列範例示範如何設定 MaximumSize 屬性。

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

備註

此屬性可讓您將表單的大小限制為指定的大小上限。 您可以在同時顯示多個視窗時使用這項功能,以確保單一視窗不會隱藏其他視窗。 如果此屬性設定為 Size 高度為 0 且寬度為 0 的物件,表單的大小將不會超過 Windows 所設定的限制。

適用於

另請參閱