0
所以我只是试图从GUI线程显示不同的线程窗体。对于我的生活中,我看不到正确的设置我的论据,这使我从捕获错误消息的调用:参数计数不匹配与Windows窗体ShowDialog委托
“参数数量不匹配”
任何想法,我应该如何正确设置参数传入?
#pragma once
#include "ErrorSystemStop.h"
using namespace System;
using namespace System::Windows::Forms;
delegate DialogResult ShowErrorWindow(System::Windows::Forms::IWin32Window^parentForm);
void ThrowErrorWindow(System::String^ strErrorMessage, int iNumberOfSegments, System::Windows::Forms::IWin32Window^parentForm)
{
//Only throw if we need too.
if(!bErrorPause)
{
MainDisplay::ErrorSystemStop^stopMe = gcnew MainDisplay::ErrorSystemStop(strErrorMessage, iNumberOfSegments);
ShowErrorWindow^disp = gcnew ShowErrorWindow((System::Windows::Forms::Form ^)stopMe, &MainDisplay::ErrorSystemStop::ShowDialog);
stopMe->TopMost = true;
try
{
cli::array<System::Windows::Forms::IWin32Window ^>^Args = gcnew cli::array<System::Windows::Forms::IWin32Window ^>(1);
Args[0] = parentForm;
stopMe->Invoke(disp,(System::Windows::Forms::Form ^)stopMe, gcnew array<System::Object ^>{Args});
}
catch(Exception ^e)
{
e->Message;
}
}
} //end ThrowErrorWindow
我也试过:
array<Object^>^Args = {parentForm};
stopMe->Invoke(disp,(System::Windows::Forms::Form ^)stopMe, Args);
谢谢
Alikar