C++ 无法访问表单标签文本
如何更改标签文本?我从C++得到的提示不起作用< /P>C++ 无法访问表单标签文本,c++,C++,如何更改标签文本?我从C++得到的提示不起作用< /P> int main(array<System::String ^> ^args) { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false);
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
Form1().label1->Text = "TEST"; //How to change label text?
return 0;
}
int main(数组^args)
{
//在创建任何控件之前启用Windows XP视觉效果
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
//创建主窗口并运行它
应用程序::运行(gcnewform1());
Form1().label1->Text=“TEST”//如何更改标签文本?
返回0;
}
在您编写的Form1
类的构造函数或加载事件中执行。保持此代码不变(即,不要从此处更改任何属性)。窗体或任何控件的属性都不应该从main
函数(理想情况下)更改。这是c++cli吗,如果是,请重新标记Form1()
如果您不知道,会创建一个新对象。类似的情况?gcnew forma=Form1();应用程序::运行(forma);机器人现在如何访问,它不显示任何提示