Form.WindowStateとは何? わかりやすく解説 Weblio辞書

Form.WindowStateとは? わかりやすく解説

Form.WindowState プロパティ

フォームウィンドウ状態を取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Property WindowState As
 FormWindowState
Dim instance As Form
Dim value As FormWindowState

value = instance.WindowState

instance.WindowState = value
public FormWindowState WindowState { get; set;
 }
public:
property FormWindowState WindowState {
    FormWindowState get ();
    void set (FormWindowState value);
}
/** @property */
public FormWindowState get_WindowState ()

/** @property */
public void set_WindowState (FormWindowState
 value)
public function get WindowState
 () : FormWindowState

public function set WindowState
 (value : FormWindowState)

プロパティ
フォームウィンドウ状態を表す FormWindowState。既定値FormWindowState.Normal です。

例外例外
例外種類条件

InvalidEnumArgumentException

指定された値が有効値の範囲内にありません。

解説解説

フォーム表示するには、初期設定値に関係なく、WindowState プロパティを常に FormWindowState.Normal設定しておきます。この設定は、HeightLeftTopWidth の各プロパティ設定値反映されます。フォーム一度表示した後に非表示にすると、これらのプロパティには、WindowState プロパティ変更したかどうかに関係なく、フォーム再度表示されるまで前の状態が反映されます。

使用例使用例

最上位フォーム作成する方法次のコード例示します。この例では、最大化表示されフォーム最上位フォーム2 つフォーム作成します最初フォーム bottomFormWindowState プロパティ最大化表示されています。これにより、最上位フォーム動作わかりやすくなります2 番目のフォーム topMostForm は、TopMost プロパティtrue設定することにより、最上位フォームとして表示されます。このコード実行すると、最大化表示されフォームクリックしても、最上位フォームがそのフォームの下に隠れることがなくなります。この例で定義されるメソッドは、他のフォームから呼び出されることを前提にしています。

Private Sub CreateMyTopMostForm()
   ' Create lower form to display.
   Dim bottomForm As New
 Form()
   ' Display the lower form Maximized to demonstrate effect of TopMost
 property.
   bottomForm.WindowState = FormWindowState.Maximized
   ' Display the bottom form.
   bottomForm.Show()
   ' Create the top most form.
   Dim topMostForm As New
 Form()
   ' Set the size of the form larger than the default size.
   topMostForm.Size = New Size(300, 300)
   ' Set the position of the top most form to center of screen.
   topMostForm.StartPosition = FormStartPosition.CenterScreen
   ' Display the form as top most form.
   topMostForm.TopMost = True
   topMostForm.Show()
End Sub 'CreateMyTopMostForm
private void CreateMyTopMostForm()
{
   // Create lower form to display.
   Form bottomForm = new Form();
   // Display the lower form Maximized to demonstrate effect of TopMost
 property.
   bottomForm.WindowState = FormWindowState.Maximized;
   // Display the bottom form.
   bottomForm.Show();
   // Create the top most form.
   Form topMostForm = new Form();
   // Set the size of the form larger than the default size.
   topMostForm.Size = new Size(300,300);
   // Set the position of the top most form to center of screen.
   topMostForm.StartPosition = FormStartPosition.CenterScreen;
   // Display the form as top most form.
   topMostForm.TopMost = true;
   topMostForm.Show();
}
private:
   void CreateMyTopMostForm()
   {
      // Create lower form to display.
      Form^ bottomForm = gcnew Form;

      // Display the lower form Maximized to demonstrate effect of TopMost
 property.
      bottomForm->WindowState = FormWindowState::Maximized;

      // Display the bottom form.
      bottomForm->Show();

      // Create the top most form.
      Form^ topMostForm = gcnew Form;

      // Set the size of the form larger than the default size.
      topMostForm->Size = System::Drawing::Size( 300, 300 );

      // Set the position of the top most form to center of screen.
      topMostForm->StartPosition = FormStartPosition::CenterScreen;

      // Display the form as top most form.
      topMostForm->TopMost = true;
      topMostForm->Show();
   }
private void CreateMyTopMostForm()
{
    // Create lower form to display.
    Form bottomForm = new Form();

    // Display the lower form Maximized to demonstrate effect
    // of TopMost property.
    bottomForm.set_WindowState(FormWindowState.Maximized);

    // Display the bottom form.
    bottomForm.Show();

    // Create the top most form.
    Form topMostForm = new Form();

    // Set the size of the form larger than the default size.
    topMostForm.set_Size(new Size(300, 300));

    // Set the position of the top most form to center of screen.
    topMostForm.set_StartPosition(FormStartPosition.CenterScreen);

    // Display the form as top most form.
    topMostForm.set_TopMost(true);
    topMostForm.Show();
} //CreateMyTopMostForm
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

FormWindowState 列挙体

フォーム ウィンドウの表示方法指定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<ComVisibleAttribute(True)> _
Public Enumeration FormWindowState
Dim instance As FormWindowState
[ComVisibleAttribute(true)] 
public enum FormWindowState
[ComVisibleAttribute(true)] 
public enum class FormWindowState
/** @attribute ComVisibleAttribute(true) */ 
public enum FormWindowState
ComVisibleAttribute(true) 
public enum FormWindowState
メンバメンバ
解説解説

この列挙体は Form クラス使用されます。この列挙体はフォームさまざまな状態を表します既定の状態は Normal です。

使用例使用例

この例では、フォームウィンドウの状態を Maximized変更しラベル使用して状態情報表示します。この例は、Form1 という名前の Form が既に作成されていることを前提にしています。

Public Sub InitMyForm()
   ' Adds a label to the form.
   Dim label1 As New Label()
   label1.Location = New System.Drawing.Point(54, 128)
   label1.Name = "label1"
   label1.Size = New System.Drawing.Size(220, 80)
   label1.Text = "Start Position Information"
   Me.Controls.Add(label1)
   
   ' Changes the windows state to Maximized.
   WindowState = FormWindowState.Maximized
   ' Displays the window information.
   label1.Text = "The Form Window is " + WindowState
End Sub 'InitMyForm
public void InitMyForm()
{
    // Adds a label to the form.
    Label label1 = new Label();
    label1.Location = new System.Drawing.Point(54, 128);
    label1.Name = "label1";
    label1.Size = new System.Drawing.Size(220, 80);
    label1.Text = "Start position information";
    this.Controls.Add(label1);

    // Changes the window state to Maximized.
    WindowState = FormWindowState.Maximized;
    // Displays the state information.
    label1.Text = "The form window is " + WindowState;    
}
public:
   void InitMyForm()
   {
      // Adds a label to the form.
      Label^ label1 = gcnew Label;
      label1->Location = System::Drawing::Point( 54, 128 );
      label1->Name = "label1";
      label1->Size = System::Drawing::Size( 220, 80 );
      label1->Text = "Start position information";
      this->Controls->Add( label1 );
      
      // Changes the window state to Maximized.
      WindowState = FormWindowState::Maximized;
      
      // Displays the state information.
      label1->Text = String::Format( "The form window is {0}", WindowState
 );
   }
public void InitMyForm()
{
    // Adds a label to the form.
    Label label1 = new Label();

    label1.set_Location(new System.Drawing.Point(54, 128));
    label1.set_Name("label1");
    label1.set_Size(new System.Drawing.Size(220, 80));
    label1.set_Text("Start position information");
    this.get_Controls().Add(label1);

    // Changes the window state to Maximized.
    set_WindowState(FormWindowState.Maximized);

    // Displays the state information.
    label1.set_Text("The form window is " + get_WindowState());
} //InitMyForm
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Form.WindowStateのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Form.WindowStateのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS