當我寫:的Visual C++枚舉(CloseReason)
private: System::Void queue_FormClosing(
System::Object^ sender,
System::Windows::Forms::FormClosingEventArgs^ e) {
if(e->CloseReason!=CloseReason::FormOwnerClosing) e->Cancel=true;
}
我得到這個錯誤:
###\queue.h(153) : error C2039: 'FormOwnerClosing' : is not a member of 'System::Windows::Forms::Form::CloseReason' 1>###\queue.h(24) : see declaration of 'System::Windows::Forms::Form::CloseReason' 1>###\queue.h(153) : error C2065: 'FormOwnerClosing' : undeclared identifier
我不明白這是爲什麼。任何人都可以幫忙嗎?
你究竟想要做什麼?你得到的錯誤是什麼? – Glen 2009-09-21 14:08:40
它在我看來,你是enum類型(CloseReason)與enum的實例(e-> CloseReason)混淆。 – 2009-09-21 14:11:18
queue_FormClosing if(e-> CloseReason!= CloseReason :: FormOwnerClosing)e-> Cancel = true; 錯誤C2065:'FormOwnerClosing':未聲明的標識符 – n00b 2009-09-21 14:11:20