【发布时间】:2013-11-25 08:58:39
【问题描述】:
所以我使用 Visual C++ 2013 使用 MFC 制作 GUI 应用程序。我已经使用 tutorial 将 C# Windows 窗体嵌入到 GUI 中,并从那里使用 tutorial 将数据绑定添加到 Windows 窗体窗口。现在,我可以在 C++ 中使用以下行来更改按钮和文本的属性:
m_MyControl.GetControl()->textBox1->Text = "text changed";
m_MyControl.GetControl()->button1->Text = "text changed";
但是当我尝试使用相同的方法来更改添加到 Windows 窗体的图表的属性时,如下所示:
m_MyControl.GetControl()->chart1->Name = "test";
然后我得到错误
error C2039: 'Name' : is not a member of System::Windows::Forms::DataVisualization::Charting::Chart'
我不知道为什么会发生这种情况,因为在 C# 设计器文件中,chart1 与 button1 和 textBox1 一起被声明为 public。我看到的唯一区别是当我将鼠标悬停在 m_Mycontrol... 行中的 button1 或 textbox1 上时,我得到了数据类型,但使用 chart1 我得到的只是
任何帮助将不胜感激。
【问题讨论】:
-
我的猜测是你没有在 Windows 窗体窗口的图表控件中声明
Name属性