Beispiel #1
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult result = MessageBox.Show("是否退出串口工具", "提示", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                e.Cancel = false;
                portControl.closePort();
                this.Dispose();
                this.Close();
            }
            else
            {
                e.Cancel = true;
            }
        }