在表单代码之外调用表单方法

时间:2017-07-20 10:51:45

标签: visual-c++

我有表格申请表:

TfidfVectorizer

我希望从外部单元函数中使用这个表单作为回调函数传递给dll函数。

我决定将表单变量声明为global:

#include "MyForm.h"

using namespace System;
using namespace System::Windows::Forms;


[STAThread]
void Main(array<String^>^ args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    CppWinForm1::MyForm form;
    Application::Run(%form);
}

但得到了错误:

#include "MyForm.h"

using namespace System;
using namespace System::Windows::Forms;
    CppWinForm1::MyForm form;


[STAThread]
void Main(array<String^>^ args)
{
    Application::EnableVisualStyles();
    Application::SetCompatibleTextRenderingDefault(false);

    Application::Run(%form);
}

如何在表单代码之外调用表单方法?

0 个答案:

没有答案