单击基于 MFC 对话框的应用程序中 WindowsFormsControlLibrary 按钮的事件

click event of WindowsFormsControlLibrary button in MFC Dialog based app

我在我的应用中使用了一些 Windows Forms Control Library 元素。

我的问题是:

如何执行此元素来自Windows Forms 控件库的按钮单击事件?

所以,我可以像这样在 ProgramDlg.cpp 文件中获取 *library* 文本框值:

void CMFCApplication1Dlg::OnBnClickedButton1()
{
    // TODO: Add your control notification handler code here
    AfxMessageBox(CString(m_ctrl1.GetControl()->textBox1->Text));
    // m_ctrl1.GetControl()->button1->Click(); 
    // how can I write this above line to perform click event?
}

我在ProgramDlg.h中定义了m_ctrl1:

// .... 
public:
        CMFCApplication1Dlg(CWnd* pParent = NULL);  // standard constructor
        // Data member for the .NET User Control:
        CWinFormsControl<WindowsFormsControlLibrary1::UserControl1> m_ctrl1;
// ....

p.s抱歉我的英语不好。

谢谢。

我通过访问 this link 解决了我的问题。

希望对其他开发者有用。