C# Windows Form: On Close Do [Process]

前端 未结 6 1987
我在风中等你
我在风中等你 2021-01-03 20:19

How can I get my windows form to do something when it is closed.

6条回答
  •  时光说笑
    2021-01-03 20:44

    Add an Event Handler to the FormClosed event for your Form.

    public class Form1
    {
    
        public Form1()
        {    
            this.FormClosed += MyClosedHandler;
        }
    
        protected void MyClosedHandler(object sender, EventArgs e)
        {
            // Handle the Event here.
        }
    }
    

提交回复
热议问题