Hi 赵国?
These are my ideas:
1. In a new thread, you called Form.Show(), but the form closes just when it shows.
Explanation: when you call Show method, the code would return immediately. So the thread would also stop immediately.
2. In the main UI thread, Form.Show() would show the form.
Explanation: the main UI thread is started by calling Application.Run(Form) which would run the message loop. In such a thread, the Form would be shows until you sends
a close message to it by calling the Close method.
3. In the new thread, From.ShowDialog() would also show the form as what we want.
This is because: ShowDialog() method would not return until we set the DialogResult or close the Form.
4.In the new thread, if we call Application.Run, the form would also show correctly.
Explanation: This is similar to case 2. The thread runs the message loop.
You can get more infomation from:
Application.Run:
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.run.aspx?br/>
Actually, when you call the show method, it shows a modeless dialog; when you call ShowDialog, it shows a modal dialog. You can get differences between these two dialogs form:
http://msdn.microsoft.com/en-us/library/ms644996(VS.85).aspxhttp://developer.kde.org/documentation/books/kde-2.0-development/ch08lev1sec3.htmlThese are some similar threads:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/090f4438-b87f-459b-89f1-db10b76c51c4http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvcs/thread/de88028b-8849-4e22-a873-5ae350531672我们希望您以后用英文提问题,这样方便大家交流,您也能获取更多的支持?br/>您也可以到中文论坛发帖:
http://social.microsoft.com/Forums/zh-CN/visualcshartzhchs/threads?br/>
Best regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.