委托和飞溅形式. [英] delegate and splash form.
本文介绍了委托和飞溅形式.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用thread-> start来显示初始表单,但不知道如何将其关闭.
尝试执行线程-> abort,但它总是会引发异常.
所以我尝试了splashform-> close()但遇到了跨线程错误.
通过google搜索,大多数人说关闭它的invoke方法会更好.
如何声明可以关闭我的初始窗体的委托函数?
请帮忙.
在c ++.net中工作.
I use thread->start to show a splash form but dont know how to close it.
Try the thread->abort but it will always raise an exception.
So I try the splashform->close() but get cross thread error.
Search through google, most of the people saying that an invoke method to close it will be better.
How do I declare a delegate function that can close my splash form?
Please help.
working in c++.net.
推荐答案
假设您正在谈论C ++.Net
Assuming your talking about C++.Net
public ref class Form1 : public System::Windows::Forms::Form
{
public:
delegate void CloseFuncDelegate();
void CloseFunc()
{
this->Close();
}
}
void funcOutside()
{
Form1^ myForm = gcnew Form1();
Form1::CloseFuncDelegate^ closeDel = gcnew Form1::CloseFuncDelegate(myForm, &Form1::CloseFunc);
myForm->Invoke(closeDel);
}
这篇关于委托和飞溅形式.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文