09/02/08 03:06:10
>>5
いちおう、本人がそこまで求めてなかろうが何だろうがこれも。
void button1_Click(...)
{
this.Close();
}
void Form_FormClosing(...FormClosingEventArgs e)
{
DialogResult result = MessageBox.Show(this, "終了しますか?", this.Text, MessageBoxButtons.YesNo);
if (result != DialogResult.Yes)
{
e.Cancel = true;
}
}
>>5
そのうち「フォームの[X]ボタンで閉じたら聞いてこなかったぞ?」という
問題に出くわすかもしれませんが、そのとき、Form.ControlBox = false に
する前にこれを思い出してください。
// でも確かFormClosingのキャンセル機能はバグがあるんだっけ?