private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBoxEx.Show("您确定要退出系统吗?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { InvokeController("Exit"); //方式一 if (BarCode != null) { BarCode.Stop(); } //方式二 CodeBarInput.DisabledAllCodeBarInput(); } }
private void FrmMain_FormClosing(object sender, FormClosingEventArgs e) { //e.Cancel = true; //this.Hide(); if (MessageBox.Show("您确定要退出系统吗?", "询问窗", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { InvokeController("Exit"); //方式一 if (BarCode != null) { BarCode.Stop(); } //方式二 CodeBarInput.DisabledAllCodeBarInput(); } else { e.Cancel = true; } }