有关表格的疑问-BringToFront [英] Doubt regarding Form - BringToFront

查看:127
本文介绍了有关表格的疑问-BringToFront的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如果我们使用BringToFront方法设置表单,表单如何显示在最前面?

Hi All,

If we set a form with BringToFront method, how the form comes to front?

this.BringToFront(); //"this" refers a form/window

推荐答案

这里是当我们使用BringToFront
时实际发生的情况的解释
最重要的是,设计人员更改了InitializeComponent方法,以便更改控件在父窗体的控件集合中的位置.

控件的默认z顺序基于控件在表单控件集合中的位置.
您可以通过单击BringToFront进行验证,然后检查设计器对InitializeComponent的更改.
here is explaination of what happens actually when we use BringToFront

Bring to front is that, The designer changes the InitializeComponent method so that the control''s location in the parent form''s controls collection is changed.

The default z-order of controls is based on their location in the form''s controls collection.
You can verify this by clicking on BringToFront and then examining the designer''s changes to InitializeComponent.


它将把控件置于z顺序的前面.

如果您想将表格带到屏幕的前面,请使用
it will Brings the control to the front of the z-order.

if you want to bring the form to front of the screen use
this.TopMost = true;
this.Focus();


这篇关于有关表格的疑问-BringToFront的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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