|
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{//捕捉窗體Close事件,關閉窗口時提示
if (MessageBox.Show("請您確認是否退出(Y/N)", "系統提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
try
{
ShutdownWinIo();
}
catch (System.Exception error)
{//WinIO卸載失敗異常
MessageBox.Show(error.Message, "系統提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
e.Cancel = false;//允許退出系統
}
else
{
e.Cancel = true;//阻止退出系統
}
}
|
|