本文介绍了在主窗体上显示非 UI 线程窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个基于表单的应用程序.它有两个在非 UI 线程上运行的模式对话框.现在该应用程序有 3 个表单.一个主窗体和两个在非 UI 线程上运行的窗体.

We have a form based application. It has two modal dialog running on non UI threads. Now the application has 3 forms. One main form and two forms running on non UI threads.

如果用户选择了应用程序,我们需要在主窗体的顶部显示非 UI 线程窗体.

We need to display the non UI thread forms on the top of main form, if the user selected the application.

我该怎么做才能做到这一点?

What should I do to do this?

推荐答案

Form 有一个 TopMost 属性可以满足您的需求.由于线程不良,您可能会得到不同的结果.

Form has a TopMost property that may do what you want. Because of the poor threading, you may have mixed results.

myDialogForm.TopMost = true;

// Then either
myDialogForm.Show();
// or
myDialogForm.ShowDialog(parentForm);

这篇关于在主窗体上显示非 UI 线程窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 04:34