为了将用户界面类(一个 Windows 窗体类)与程序的其余部分分开,我试图从 int WINAPI WinMain () 调用 Windows 窗体方法
例如,我正在尝试执行以下操作:
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
Application::EnableVisualStyles();
UserInterface1 ^myInterface = gcnew UserInterface1();
String ^ picture1 = "img1";
String ^ picture2 = "img2";
Application::Run(myInterface);
Bitmap^ B = gcnew Bitmap (512,512);
//user defined class that reads an image from a file
PImage PI(picture1);
//a Windows Forms method that updates the image displayed in a pictureBox element
myInterface->ModifyDisplay (B, PI);
//user defined class that reads an image from a file
PImage PI2(picture2);
//a Windows Forms method that updates the image displayed in a pictureBox element
myInterface->ModifyDisplay (B, PI2);
return 0;
}
不用说,它并没有像现在这样工作,而且我不确定我正在尝试做的事情是否可行,因为我对 .Net 编程还很陌生。