Application.Run Method

定義

現在のスレッドで標準のアプリケーション メッセージ ループの実行を開始します。 Begins running a standard application message loop on the current thread.

オーバーロード

Run()

現在のスレッドで標準のアプリケーション メッセージ ループの実行を、フォームなしで開始します。 Begins running a standard application message loop on the current thread, without a form.

Run(ApplicationContext)

ApplicationContext を使用して、現在のスレッドで標準のアプリケーション メッセージ ループの実行を開始します。 Begins running a standard application message loop on the current thread, with an ApplicationContext.

Run(Form)

現在のスレッドで標準のアプリケーション メッセージ ループの実行を開始し、指定したフォームを表示します。 Begins running a standard application message loop on the current thread, and makes the specified form visible.

Run()

現在のスレッドで標準のアプリケーション メッセージ ループの実行を、フォームなしで開始します。 Begins running a standard application message loop on the current thread, without a form.

public static void Run ();
例外

メイン メッセージ ループが既にこのスレッドで実行中です。 A main message loop is already running on this thread.

注釈

Win32 ベースまたは Windows フォームで、アプリケーション メッセージ ループは、マウス クリックやキーボード入力などのユーザー イベントを処理するコード内のルーチンです。In a Win32-based or Windows Forms application, a message loop is a routine in code that processes user events, such as mouse clicks and keyboard strokes. すべて実行中の Windows ベースのアプリケーションでは、メイン メッセージ ループと呼ばれる、アクティブなメッセージ ループが必要です。Every running Windows-based application requires an active message loop, called the main message loop. メイン メッセージ ループが閉じられたときに、アプリケーションを終了します。When the main message loop is closed, the application exits. Windows フォームでは、このループを閉じたときに、Exitメソッドが呼び出されたとき、または、ExitThreadメイン メッセージ ループを実行しているスレッドでメソッドが呼び出されます。In Windows Forms, this loop is closed when the Exit method is called, or when the ExitThread method is called on the thread that is running the main message loop.

ほとんどの Windows フォーム開発者は、このバージョンのメソッドを使用する必要はありません。Most Windows Forms developers will not need to use this version of the method. 使用する必要があります、Run(Form)メイン フォームが閉じられたときに、アプリケーションが終了するように、メイン フォーム アプリケーションを起動するオーバー ロードします。You should use the Run(Form) overload to start an application with a main form, so that the application terminates when the main form is closed. その他のすべての状況では、使用、Run(ApplicationContext)の指定をサポートする、オーバー ロード、ApplicationContextオブジェクト、アプリケーションの有効期間の制御を強化します。For all other situations, use the Run(ApplicationContext) overload, which supports supplying an ApplicationContext object for better control over the lifetime of the application.

こちらもご覧ください

Run(ApplicationContext)

ApplicationContext を使用して、現在のスレッドで標準のアプリケーション メッセージ ループの実行を開始します。 Begins running a standard application message loop on the current thread, with an ApplicationContext.

public static void Run (System.Windows.Forms.ApplicationContext context);
パラメーター
context
ApplicationContext

アプリケーションが実行される ApplicationContext An ApplicationContext in which the application is run.

例外

メイン メッセージ ループが既にこのスレッドで実行中です。 A main message loop is already running on this thread.

例では、2 つの形式を表示し、両方のフォームが閉じられたときにアプリケーションを終了します。The example displays two forms and exits the application when both forms are closed. アプリケーションを起動し、終了、各フォームの位置が記憶されます。When the application starts and exits, the position of each form is remembered. この例では、使用、 ApplicationContext、と共に、Application.Run(context)メソッドは、アプリケーションの起動時に、複数のフォームを表示します。This example demonstrates how to use an ApplicationContext, along with the Application.Run(context) method, to display multiple forms when the application starts.

クラスは、MyApplicationContext継承ApplicationContextし、各フォームが閉じられるし、はどちらも、ときに、現在のスレッドを終了するときは常に追跡します。The class MyApplicationContext inherits from ApplicationContext and keeps track when each form is closed, and exits the current thread when they both are. クラスは、ユーザーの各フォームの位置を格納します。The class stores the positions of each form for the user. フォームの位置データがという名前のファイルに格納されているAppdata.txtによって決定の場所に作成されるUserAppDataPathします。The form position data is stored in a file titled Appdata.txt that is created in the location determined by UserAppDataPath. Mainメソッド呼び出しApplication.Run(context)に基づいてアプリケーションを開始する、ApplicationContextします。The Main method calls Application.Run(context) to start the application given the ApplicationContext.

コードをAppForm1AppForm2簡略にするためのフォームが示されていません。The code for the AppForm1 and AppForm2 forms is not shown for the purpose of brevity. 参照してください、ApplicationContextコード全体のクラスの概要。See the ApplicationContext class overview for the whole code listing.

// The class that handles the creation of the application windows
ref class MyApplicationContext: public ApplicationContext
{
private:
   int formCount;
   AppForm1^ form1;
   AppForm2^ form2;
   System::Drawing::Rectangle form1Position;
   System::Drawing::Rectangle form2Position;
   FileStream^ userData;

public:

   MyApplicationContext()
   {
      formCount = 0;
      
      // Handle the ApplicationExit event to know when the application is exiting.
      Application::ApplicationExit += gcnew EventHandler( this, &MyApplicationContext::OnApplicationExit );
      try
      {
         
         // Create a file that the application will store user specific data in.
         userData = gcnew FileStream( String::Concat( Application::UserAppDataPath, "\\appdata.txt" ),FileMode::OpenOrCreate );
      }
      catch ( IOException^ e ) 
      {
         
         // Inform the user that an error occurred.
         MessageBox::Show( "An error occurred while attempting to show the application. The error is: {0}", dynamic_cast<String^>(e) );
         
         // Exit the current thread instead of showing the windows.
         ExitThread();
      }

      
      // Create both application forms and handle the Closed event
      // to know when both forms are closed.
      form1 = gcnew AppForm1;
      form1->Closed += gcnew EventHandler( this, &MyApplicationContext::OnFormClosed );
      form1->Closing += gcnew CancelEventHandler( this, &MyApplicationContext::OnFormClosing );
      formCount++;
      form2 = gcnew AppForm2;
      form2->Closed += gcnew EventHandler( this, &MyApplicationContext::OnFormClosed );
      form2->Closing += gcnew CancelEventHandler( this, &MyApplicationContext::OnFormClosing );
      formCount++;
      
      // Get the form positions based upon the user specific data.
      if ( ReadFormDataFromFile() )
      {
         
         // If the data was read from the file, set the form
         // positions manually.
         form1->StartPosition = FormStartPosition::Manual;
         form2->StartPosition = FormStartPosition::Manual;
         form1->Bounds = form1Position;
         form2->Bounds = form2Position;
      }

      
      // Show both forms.
      form1->Show();
      form2->Show();
   }

   void OnApplicationExit( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      
      // When the application is exiting, write the application data to the
      // user file and close it.
      WriteFormDataToFile();
      try
      {
         
         // Ignore any errors that might occur while closing the file handle.
         userData->Close();
      }
      catch ( Exception^ ) 
      {
      }

   }


private:

   void OnFormClosing( Object^ sender, CancelEventArgs^ /*e*/ )
   {
      
      // When a form is closing, remember the form position so it
      // can be saved in the user data file.
      if ( dynamic_cast<AppForm1^>(sender) != nullptr )
            form1Position = (dynamic_cast<Form^>(sender))->Bounds;
      else
      if ( dynamic_cast<AppForm1^>(sender) != nullptr )
            form2Position = (dynamic_cast<Form^>(sender))->Bounds;
   }


   void OnFormClosed( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      
      // When a form is closed, decrement the count of open forms.
      // When the count gets to 0, exit the app by calling
      // ExitThread().
      formCount--;
      if ( formCount == 0 )
      {
         ExitThread();
      }
   }


   bool WriteFormDataToFile()
   {
      
      // Write the form positions to the file.
      UTF8Encoding^ encoding = gcnew UTF8Encoding;
      RectangleConverter^ rectConv = gcnew RectangleConverter;
      String^ form1pos = rectConv->ConvertToString( form1Position );
      String^ form2pos = rectConv->ConvertToString( form2Position );
      array<Byte>^dataToWrite = encoding->GetBytes( String::Concat( "~", form1pos, "~", form2pos ) );
      try
      {
         
         // Set the write position to the start of the file and write
         userData->Seek( 0, SeekOrigin::Begin );
         userData->Write( dataToWrite, 0, dataToWrite->Length );
         userData->Flush();
         userData->SetLength( dataToWrite->Length );
         return true;
      }
      catch ( Exception^ ) 
      {
         
         // An error occurred while attempting to write, return false.
         return false;
      }

   }

   bool ReadFormDataFromFile()
   {
      
      // Read the form positions from the file.
      UTF8Encoding^ encoding = gcnew UTF8Encoding;
      String^ data;
      if ( userData->Length != 0 )
      {
         array<Byte>^dataToRead = gcnew array<Byte>(userData->Length);
         try
         {
            
            // Set the read position to the start of the file and read.
            userData->Seek( 0, SeekOrigin::Begin );
            userData->Read( dataToRead, 0, dataToRead->Length );
         }
         catch ( IOException^ e ) 
         {
            String^ errorInfo = dynamic_cast<String^>(e);
            
            // An error occurred while attempt to read, return false.
            return false;
         }

         
         // Parse out the data to get the window rectangles
         data = encoding->GetString( dataToRead );
         try
         {
            
            // Convert the String* data to rectangles
            RectangleConverter^ rectConv = gcnew RectangleConverter;
            String^ form1pos = data->Substring( 1, data->IndexOf( "~", 1 ) - 1 );
            form1Position =  *safe_cast<Rectangle^>(rectConv->ConvertFromString( form1pos ));
            String^ form2pos = data->Substring( data->IndexOf( "~", 1 ) + 1 );
            form2Position =  *safe_cast<Rectangle^>(rectConv->ConvertFromString( form2pos ));
            return true;
         }
         catch ( Exception^ ) 
         {
            
            // Error occurred while attempting to convert the rectangle data.
            // Return false to use default values.
            return false;
         }

      }
      else
      {
         
         // No data in the file, return false to use default values.
         return false;
      }
   }

};


// The class that handles the creation of the application windows
class MyApplicationContext : ApplicationContext {

    private int formCount;
    private AppForm1 form1;
    private AppForm2 form2;

    private Rectangle form1Position;
    private Rectangle form2Position;

    private FileStream userData;

    private MyApplicationContext() {
        formCount = 0;

        // Handle the ApplicationExit event to know when the application is exiting.
        Application.ApplicationExit += new EventHandler(this.OnApplicationExit);

        try {
            // Create a file that the application will store user specific data in.
            userData = new FileStream(Application.UserAppDataPath + "\\appdata.txt", FileMode.OpenOrCreate);

        } catch(IOException e) {
            // Inform the user that an error occurred.
            MessageBox.Show("An error occurred while attempting to show the application." + 
                            "The error is:" + e.ToString());

            // Exit the current thread instead of showing the windows.
            ExitThread();
        }

        // Create both application forms and handle the Closed event
        // to know when both forms are closed.
        form1 = new AppForm1();
        form1.Closed += new EventHandler(OnFormClosed);            
        form1.Closing += new CancelEventHandler(OnFormClosing);            
        formCount++;

        form2 = new AppForm2();
        form2.Closed += new EventHandler(OnFormClosed);            
        form2.Closing += new CancelEventHandler(OnFormClosing);            
        formCount++;

        // Get the form positions based upon the user specific data.
        if (ReadFormDataFromFile()) {
            // If the data was read from the file, set the form
            // positions manually.
            form1.StartPosition = FormStartPosition.Manual;
            form2.StartPosition = FormStartPosition.Manual;
            
            form1.Bounds = form1Position;
            form2.Bounds = form2Position;
        }

        // Show both forms.
        form1.Show();
        form2.Show();
    }

    private void OnApplicationExit(object sender, EventArgs e) {
        // When the application is exiting, write the application data to the
        // user file and close it.
        WriteFormDataToFile();

        try {
            // Ignore any errors that might occur while closing the file handle.
            userData.Close();
        } catch {}
    }

    private void OnFormClosing(object sender, CancelEventArgs e) {
        // When a form is closing, remember the form position so it
        // can be saved in the user data file.
        if (sender is AppForm1) 
            form1Position = ((Form)sender).Bounds;
        else if (sender is AppForm2)
            form2Position = ((Form)sender).Bounds;
    }

    private void OnFormClosed(object sender, EventArgs e) {
        // When a form is closed, decrement the count of open forms.

        // When the count gets to 0, exit the app by calling
        // ExitThread().
        formCount--;
        if (formCount == 0) {
            ExitThread();
        }
    }

    private bool WriteFormDataToFile(){
        // Write the form positions to the file.
        UTF8Encoding encoding = new UTF8Encoding();

        RectangleConverter rectConv = new RectangleConverter();
        String form1pos = rectConv.ConvertToString(form1Position);
        String form2pos = rectConv.ConvertToString(form2Position);

        byte[] dataToWrite = encoding.GetBytes("~" + form1pos + "~" + form2pos);

        try {
            // Set the write position to the start of the file and write
            userData.Seek(0,SeekOrigin.Begin);
            userData.Write(dataToWrite, 0, dataToWrite.Length);
            userData.Flush();

            userData.SetLength(dataToWrite.Length);
            return true;

        } catch {
            // An error occurred while attempting to write, return false.
            return false;
        }

    }

    private bool ReadFormDataFromFile(){
        // Read the form positions from the file.
        UTF8Encoding encoding = new UTF8Encoding();
        String data;

        if (userData.Length != 0) {
            byte[] dataToRead = new Byte[userData.Length];

            try {
                // Set the read position to the start of the file and read.
                userData.Seek(0, SeekOrigin.Begin);
                userData.Read(dataToRead, 0, dataToRead.Length);

            } catch (IOException e) {
                String errorInfo = e.ToString();
                // An error occurred while attempt to read, return false.
                return false;
            }

            // Parse out the data to get the window rectangles
            data = encoding.GetString(dataToRead);

            try {
                // Convert the string data to rectangles
                RectangleConverter rectConv = new RectangleConverter();
                String form1pos = data.Substring(1,data.IndexOf("~",1)-1);

                form1Position = (Rectangle)rectConv.ConvertFromString(form1pos);

                String form2pos = data.Substring(data.IndexOf("~",1)+1);
                form2Position = (Rectangle)rectConv.ConvertFromString(form2pos);

                return true;

            } catch {
                // Error occurred while attempting to convert the rectangle data.
                // Return false to use default values.
                return false;
            }

        } else {
            // No data in the file, return false to use default values.
            return false;
        }
    }        
    
    [STAThread]
    static void Main(string[] args) {
        
        // Create the MyApplicationContext, that derives from ApplicationContext,
        // that manages when the application should exit.

        MyApplicationContext context = new MyApplicationContext();

        // Run the application with the specific context. It will exit when
        // all forms are closed.
        Application.Run(context);

    }
}
' The class that handles the creation of the application windows
Public Class MyApplicationContext
    Inherits ApplicationContext

    Private formCount As Integer
    Private form1 As AppForm1
    Private form2 As AppForm2

    Private form1Position As Rectangle
    Private form2Position As Rectangle

    Private userData As FileStream

    Public Sub New()
        MyBase.New()
        formCount = 0

        ' Handle the ApplicationExit event to know when the application is exiting.
        AddHandler Application.ApplicationExit, AddressOf OnApplicationExit

        Try
            ' Create a file that the application will store user specific data in.
            userData = New FileStream(Application.UserAppDataPath + "\appdata.txt", FileMode.OpenOrCreate)

        Catch e As IOException
            ' Inform the user that an error occurred.
            MessageBox.Show("An error occurred while attempting to show the application." + _
                            "The error is:" + e.ToString())

            ' Exit the current thread instead of showing the windows.
            ExitThread()
        End Try

        ' Create both application forms and handle the Closed event
        ' to know when both forms are closed.
        form1 = New AppForm1()
        AddHandler form1.Closed, AddressOf OnFormClosed
        AddHandler form1.Closing, AddressOf OnFormClosing
        formCount = formCount + 1

        form2 = New AppForm2()
        AddHandler form2.Closed, AddressOf OnFormClosed
        AddHandler form2.Closing, AddressOf OnFormClosing
        formCount = formCount + 1

        ' Get the form positions based upon the user specific data.
        If (ReadFormDataFromFile()) Then
            ' If the data was read from the file, set the form
            ' positions manually.
            form1.StartPosition = FormStartPosition.Manual
            form2.StartPosition = FormStartPosition.Manual

            form1.Bounds = form1Position
            form2.Bounds = form2Position
        End If

        ' Show both forms.
        form1.Show()
        form2.Show()
    End Sub

    Private Sub OnApplicationExit(ByVal sender As Object, ByVal e As EventArgs)
        ' When the application is exiting, write the application data to the
        ' user file and close it.
        WriteFormDataToFile()

        Try
            ' Ignore any errors that might occur while closing the file handle.
            userData.Close()
        Catch
        End Try
    End Sub

    Private Sub OnFormClosing(ByVal sender As Object, ByVal e As CancelEventArgs)
        ' When a form is closing, remember the form position so it
        ' can be saved in the user data file.
        If TypeOf sender Is AppForm1 Then
            form1Position = CType(sender, Form).Bounds
        ElseIf TypeOf sender Is AppForm2 Then
            form2Position = CType(sender, Form).Bounds
        End If
    End Sub
    
    Private Sub OnFormClosed(ByVal sender As Object, ByVal e As EventArgs)
        ' When a form is closed, decrement the count of open forms.

        ' When the count gets to 0, exit the app by calling
        ' ExitThread().
        formCount = formCount - 1
        If (formCount = 0) Then
            ExitThread()
        End If
    End Sub

    Private Function WriteFormDataToFile() As Boolean
        ' Write the form positions to the file.
        Dim encoding As UTF8Encoding = New UTF8Encoding()

        Dim rectConv As RectangleConverter = New RectangleConverter()
        Dim form1pos As String = rectConv.ConvertToString(form1Position)
        Dim form2pos As String = rectConv.ConvertToString(form2Position)

        Dim dataToWrite As Byte() = encoding.GetBytes("~" + form1pos + "~" + form2pos)

        Try
            ' Set the write position to the start of the file and write
            userData.Seek(0, SeekOrigin.Begin)
            userData.Write(dataToWrite, 0, dataToWrite.Length)
            userData.Flush()

            userData.SetLength(dataToWrite.Length)
            Return True

        Catch
            ' An error occurred while attempting to write, return false.
            Return False
        End Try

    End Function

    Private Function ReadFormDataFromFile() As Boolean
        ' Read the form positions from the file.
        Dim encoding As UTF8Encoding = New UTF8Encoding()
        Dim data As String

        If (userData.Length <> 0) Then
            Dim dataToRead(userData.Length) As Byte

            Try
                ' Set the read position to the start of the file and read.
                userData.Seek(0, SeekOrigin.Begin)
                userData.Read(dataToRead, 0, dataToRead.Length)

            Catch e As IOException
                Dim errorInfo As String = e.ToString()
                ' An error occurred while attempt to read, return false.
                Return False
            End Try

            ' Parse out the data to get the window rectangles
            data = encoding.GetString(dataToRead)

            Try
                ' Convert the string data to rectangles
                Dim rectConv As RectangleConverter = New RectangleConverter()
                Dim form1pos As String = data.Substring(1, data.IndexOf("~", 1) - 1)

                form1Position = CType(rectConv.ConvertFromString(form1pos), Rectangle)

                Dim form2pos As String = data.Substring(data.IndexOf("~", 1) + 1)
                form2Position = CType(rectConv.ConvertFromString(form2pos), Rectangle)

                Return True

            Catch
                ' Error occurred while attempting to convert the rectangle data.
                ' Return false to use default values.
                Return False
            End Try

        Else
            ' No data in the file, return false to use default values.
            Return False
        End If
    End Function

End Class

Public Module MyApplication
    Public Sub Main()
        ' Create the MyApplicationContext, that derives from ApplicationContext,
        ' that manages when the application should exit.

        Dim context As MyApplicationContext = New MyApplicationContext()

        ' Run the application with the specific context. It will exit when
        ' all forms are closed.
        Application.Run(context)
    End Sub
End Module

注釈

メッセージ ループの実行までExitまたはExitThreadと呼びますまたはThreadExitコンテキスト オブジェクトでイベントが発生します。The message loop runs until Exit or ExitThread is called or the ThreadExit event is raised on the context object.

こちらもご覧ください

Run(Form)

現在のスレッドで標準のアプリケーション メッセージ ループの実行を開始し、指定したフォームを表示します。 Begins running a standard application message loop on the current thread, and makes the specified form visible.

public static void Run (System.Windows.Forms.Form mainForm);
パラメーター
mainForm
Form

表示するフォームを表す Form A Form that represents the form to make visible.

例外

メイン メッセージ ループが既に現在のスレッドで実行中です。 A main message loop is already running on the current thread.

次のコード例は、フォームのリスト ボックス内の番号を一覧表示します。The following code example lists numbers in a list box on a form. クリックするたびにbutton1アプリケーションの一覧に別の番号を追加します。Each time you click button1, the application adds another number to the list.

Mainメソッド呼び出しRunフォームを作成すると、アプリケーションを起動するlistBox1、およびbutton1します。The Main method calls Run to start the application, which creates the form, listBox1, and button1. ユーザーがクリックするとbutton1button1_Clickメソッドは、リスト ボックスには、1 ~ 3 の番号を追加し、表示、MessageBoxします。When the user clicks button1, the button1_Click method adds numbers one to three to the list box, and displays a MessageBox. ユーザーがクリックした場合いいえ上、 MessageBoxbutton1_Clickメソッドの一覧に別の番号を追加します。If the user clicks No on the MessageBox, the button1_Click method adds another number to the list. ユーザーがクリックした場合 [はい]、アプリケーション呼び出しExitをキューに残りのすべてのメッセージを処理し、終了します。If the user clicks Yes, the application calls Exit to process all remaining messages in the queue and then to quit.

この例では、する必要がありますlistBox1button1作成して、フォーム上に配置します。The example requires that listBox1 and button1 have been created and placed on a form.

public:
   static void main()
   {
      // Starts the application.
      Application::Run( gcnew Form1 );
   }

private:
   void button1_Click( Object^ sender, System::EventArgs^ e )
   {
      // Populates a list box with three numbers.
      int i = 3;
      for ( int j = 1; j <= i; j++ )
      {
         listBox1->Items->Add( j );
      }
      
      /* Determines whether the user wants to exit the application.
       * If not, adds another number to the list box. */
      while ( MessageBox::Show( "Exit application?", "",
         MessageBoxButtons::YesNo ) == ::DialogResult::No )
      {
         // Increments the counter ands add the number to the list box.
         i++;
         listBox1->Items->Add( i );
      }
      
      // The user wants to exit the application. Close everything down.
      Application::Exit();
   }
public static void Main(string[] args) {
    // Starts the application.
    Application.Run(new Form1());
 }
 
 private void button1_Click(object sender, System.EventArgs e) {
    // Populates a list box with three numbers.
    int i = 3;
    for(int j=1; j<=i; j++) {
       listBox1.Items.Add(j);
    }
 
    /* Determines whether the user wants to exit the application.
     * If not, adds another number to the list box. */
    while (MessageBox.Show("Exit application?", "", MessageBoxButtons.YesNo) == 
       DialogResult.No) {
       // Increments the counter ands add the number to the list box.
       i++;
       listBox1.Items.Add(i);
    }
 
    // The user wants to exit the application. Close everything down.
    Application.Exit();
 }

<STAThread()> _
Shared Sub Main() 	
   ' Starts the application.
   Application.Run(New Form1())
End Sub

Private Sub button1_Click(sender As object, e As System.EventArgs)
   ' Populates a list box with three numbers.
   Dim i As Integer = 3
   Dim j As Integer
   For j = 1 To i - 1
      listBox1.Items.Add(j)
   Next

   ' Checks to see whether the user wants to exit the application.
   ' If not, adds another number to the list box.
   While (MessageBox.Show("Exit application?", "", MessageBoxButtons.YesNo) = _ 
      DialogResult.No)
      ' Increments the counter and adds the number to the list box.
      i = i + 1
      listBox1.Items.Add(i)
   End While

   ' The user wants to exit the application. Close everything down.
   Application.Exit()
End Sub

注釈

通常、アプリケーションの main 関数では、このメソッドを呼び出すし、アプリケーションのメイン ウィンドウを渡します。Typically, the main function of an application calls this method and passes to it the main window of the application.

このメソッドは、イベント ハンドラーを追加、mainFormのパラメーター、Closedイベント。This method adds an event handler to the mainForm parameter for the Closed event. イベント ハンドラー呼び出しExitThreadアプリケーションをクリーンアップします。The event handler calls ExitThread to clean up the application.

注意

Disposeのメソッド、Formクラスがこのメソッドの戻り値の前に呼び出されます。The Dispose method of the Form class will be called prior to the return of this method.

こちらもご覧ください

適用対象