Control.Layout イベント
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

public: event LayoutEventHandler^ Layout { void add (LayoutEventHandler^ value); void remove (LayoutEventHandler^ value); }

Layout イベントは、子コントロールが追加または削除されるとき、コントロールの境界が変更されるとき、およびコントロールのレイアウトに影響を与える可能性があるその他の変化が発生するときに発生します。レイアウト イベントは、SuspendLayout メソッドおよび ResumeLayout メソッドを使用して中止できます。レイアウトを中断すると、各変更に対してレイアウトを実行しなくても、コントロールで複数のアクションを実行できます。たとえば、コントロールのサイズを変更して移動する場合は、各操作で Layout イベントが発生します。

Layout イベントで画面の中央に Form を配置するコード例を次に示します。これにより、ユーザーがフォームのサイズを変更しても、フォームは中央に配置されます。この例では、Form コントロールが既に作成されている必要があります。
Private Sub MyForm_Layout(ByVal sender As Object, _ ByVal e As System.Windows.Forms.LayoutEventArgs) Handles MyBase.Layout ' Center the Form on the user's screen everytime it requires a Layout. Me.SetBounds((System.Windows.Forms.Screen.GetBounds(Me).Width / 2) - (Me.Width / 2), _ (System.Windows.Forms.Screen.GetBounds(Me).Height / 2) - (Me.Height / 2), _ Me.Width, Me.Height, System.Windows.Forms.BoundsSpecified.Location) End Sub
private void MyForm_Layout(object sender, System.Windows.Forms.LayoutEventArgs e) { // Center the Form on the user's screen everytime it requires a Layout. this.SetBounds((Screen.GetBounds(this).Width/2) - (this.Width/2), (Screen.GetBounds(this).Height/2) - (this.Height/2) , this.Width, this.Height, BoundsSpecified.Location); }
private: void MyForm_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ /*e*/ ) { // Center the Form on the user's screen everytime it requires a Layout. this->SetBounds( (Screen::GetBounds( this ).Width / 2) - (this->Width / 2), (Screen::GetBounds( this ).Height / 2) - (this->Height / 2), this->Width, this->Height, BoundsSpecified::Location ); }
private void MyForm_Layout(Object sender, System.Windows.Forms.LayoutEventArgs e) { // Center the Form on the user's screen everytime it requires a Layout. this.SetBounds(Screen.GetBounds(this).get_Width() / 2 - this.get_Width() / 2, Screen.GetBounds(this).get_Height() / 2 - this.get_Height() / 2, this.get_Width(), this.get_Height(), BoundsSpecified.Location); } //MyForm_Layout

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からControl.Layout イベントを検索する場合は、下記のリンクをクリックしてください。

- Control.Layout イベントのページへのリンク