我正在試圖使用此代碼來關閉消息框的特定答案上的窗體。我一直收到一個錯誤,說Yes
和No
都不屬於DialogResult::
。我基本上直接從MS站點複製這段代碼,所以我不知道什麼是錯的。幫幫我?消息框上的關閉窗體回答問題
private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
if(!watchdog->Checked)
{
if((MessageBox::Show("CAN Watchdog is currently OFF. If you exit with these settings, the SENSOWheel will still be engaged. To prevent this, please enable CAN Watchdog before closing. Would you still like to quit?", "Watchdog Warning", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == DialogResult::No))
{
return;
}
else
{
close_Click(this, e);
}
}
}
這是一個C++問題,它沒有爲類型標識符保留單獨的符號表。您必須完整輸入名稱以避免Form :: DialogResult帶來的歧義。 – 2011-06-14 13:21:37