如何使表单始终位于另一个表单之上 [英] How to make a form always stay on top of another form

查看:27
本文介绍了如何使表单始终位于另一个表单之上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使表单始终位于另一个表单之上.

而且两个表单的 enabled 属性都必须为 true

我不想使用最高级的财产.

C# 中的另一个类似问题说你可以使用 Form.Owner 属性 来解决这个问题,如何利用这个属性?

编辑 2:所有者属性工作正常,直到我第二次尝试打开它.

这是我收到的错误信息

解决方案

我相信你需要 frm.ShowDialog() 而不是 frm.Show()>

frm 是您需要在当前表单上显示的另一种表单,而不是使用 Show,这将使其成为当前表单上的对话框表单(但是您将无法选择父表单或表单除非您关闭 frm 表单

编辑

在两个表单上启用编辑

Form2 frm = new Form2();frm.Owner = 这个;frm.Show();

希望能帮到你.

How to make a form always stay on top of another form.

Also both form's enabled property must be true

I don't wanna make use of topmost property.

Edit 1 :

Another similar question in C# says you can use Form.Owner Property to do the trick , how to make use of this property ?

Edit 2 : The Owner Property works fine untill I try to open it the second time.

This is the error message I get

解决方案

I believe you need the frm.ShowDialog() instead of frm.Show()

frm is the other form you need to show over your current form and instead of using Show, this will make it as a dialog form over your current form (however you won't be able to select the parent form or the form behind it unless you close the frm form

EDIT

To enable edit on both forms

Form2 frm = new Form2();
frm.Owner = this;
frm.Show();

Hope this helps you out.

这篇关于如何使表单始终位于另一个表单之上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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