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