【问题标题】:How change Visual Studio Desginer events?如何更改 Visual Studio 设计器事件?
【发布时间】:2020-05-25 16:27:02
【问题描述】:

是否可以更改 Visual Studio 设计器中按钮上的事件的工作方式?

例如,当您双击 button1(以获取 button1_click)时,Visual Studio Designer 会创建以下代码:

“MyForm.h”

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
}
};

但是,我希望 Visual Studio 设计师创建以下代码:

“MyForm.h”

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e);

“MyForm.cpp”

System::Void MyForm::button1_Click(System::Object^ sender, System::EventArgs^ e) 
{

}

【问题讨论】:

  • 根据需要进行更改时编译器会给出什么错误?
  • 我没有收到任何错误,它有效,我想知道是否可以在添加事件时自动进行这些更改。

标签: c++ visual-studio winforms visual-c++ clr


【解决方案1】:

您在使用 Wizard 时是否有相同的行为?

右击你的按钮

【讨论】:

  • 我没有这些选项。我没有使用 MFC,我使用的是 CLR 空项目 (.NET Framework)。
猜你喜欢
  • 2011-01-18
  • 2018-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-04-12
  • 2011-09-14
相关资源
最近更新 更多