如何使表格始终在应用程序的顶部 [英] How to make form always on top in Application

查看:42
本文介绍了如何使表格始终在应用程序的顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表单,当它在应用程序中打开时,我希望它始终位于顶部,但我不希望它在主表单最小化或导航另一个应用程序时位于顶部.我希望它仅在我的应用程序中位于顶部.

I have a form that i want to always be on top whenever it is opened in the application but i dont want it to be on top when the main form is minimized or another application is navigated. I want it to be on top only in my application.

按照问题中的答案:如何使窗口始终保持在 .Net 的顶部?

    this.TopMost = true;

使表单位于顶部,但当导航到另一个应用程序或主表单关闭时,该表单仍位于顶部.

Makes the form on top but the form is still on top when another application is navigated to or the main form is closed.

请问如何使表单仅位于应用程序的顶部,同时使用户仍然可以在主表单上工作?

Pls how do i make the form only on top in the application while enabling user to still work on the main form?

推荐答案

您正在寻找一个拥有的窗口.它始终位于所有者之上,并且与所有者一起最小化.自有窗口的好例子是 Visual Studio 中的各种帮助窗口.您可以取消停靠它们,但它们将始终停留在 VS 主窗口的顶部.

You are looking for an owned window. It is always on top of the owner and it gets minimized along with the owner. Good examples of owned windows are the various helper windows inside Visual Studio. You can undock them but they'll always stay on top of the VS main window.

您可以通过使用 Show(owner) 重载来显示一个拥有的窗口.或者通过显式分配其 Owner 属性.

You create an owned window by displaying it with the Show(owner) overload. Or by explicitly assigning its Owner property.

这篇关于如何使表格始终在应用程序的顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆