我使用以下代码禁用了表单的关闭按钮:
virtual property System::Windows::Forms::CreateParams^ CreateParams
{
System::Windows::Forms::CreateParams^ get() override
{
System::Windows::Forms::CreateParams^ cp = Form::CreateParams;
cp->ClassStyle |= 0x200; //CP_NOCLOSE_BUTTON
return cp;
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我想在例如 foo() 函数中重新启用此关闭按钮。我能怎么做?
我正在使用 VS Code 在 Linux 中使用 g++ 进行编译和调试。
需要包括和使用:
#include <string>
#include <iostream>
using namespace std;
Run Code Online (Sandbox Code Playgroud)
这是我的类是可移动的:
class A {
public:
A(const string& strA) : strA(strA) {}
A(const A& a) : A(a.strA) {
}
A(A&& a) : A(a.strA) {
a.strA = "";
}
string strA;
};
Run Code Online (Sandbox Code Playgroud)
返回 A 实例的示例函数:
A RetA() {
A a("a");
A b("bha");
string ex;
cin >> ex;
a.strA += ex;
return ex == "123" ? a : b;
}
Run Code Online (Sandbox Code Playgroud)
这是简单的主要内容:
int main() {
A a(RetA());
return …Run Code Online (Sandbox Code Playgroud)