本文介绍了C#.net - 当MDI Parent中有一些控件时,如何将MDI子窗体带到前面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

- 当MDI Parent中有一些控件时,如何将MDI子窗体带到前面



我创建了一个 MDI Parent包含Split Container& amp;树形视图控件,当我尝试打开一个窗体(MDI子)时,该窗体在拆分容器后面打开。有人可以解释如何设置这个权利。



如果这是使用控件类 - MDICLIENT ...我们现在如何表示代表子表单的客户端控件的确切数量。

Ex:



以下代码中我们不知道 i 的价值



- How to bring a MDI child form to the front when MDI Parent has some controls in it

I have created a "MDI Parent" form containing a Split Container & Tree View Controls, when i try to open a Form (MDI Child), that form opens behind the Split Container. Could some one please explain how to set this right.

If this is using controls class - MDICLIENT ... how do we now the exact number of the client control which represents the Child Form.
Ex:

in the following code we do not know the value for i

MdiClient mdiClient = null;

               // Get the MdiClient from the parent form.

               for (int i = 0; i < this.Controls.Count; i++)
               {
      // If the form is an MDI container, it will contain an MdiClient control

   // just as it would any other control.

                 mdiClient = this.Controls[i] as MdiClient;
                   if (mdiClient != null)
                   {
                       // The MdiClient control was found.

                     // MessageBox.Show("name "+mdiClient.ToString());

                       //
                       mdiClient.BringToFront();

                       break;
                   }
               }

推荐答案




这篇关于C#.net - 当MDI Parent中有一些控件时,如何将MDI子窗体带到前面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 15:31