子窗口对接MDI窗体 [英] Child windows docking in MDI forms

查看:301
本文介绍了子窗口对接MDI窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个MDI形式中的一些子窗口。我停靠的子窗口MDI的不同领域,但是当焦点失去每一形成另一个停靠形式将重新排列和每一件事情要爆炸的。因为这个问题困惑我准备了一组图片显示反应

I have a MDI form and some child windows within. I dock the child windows to the different areas of MDI but when the focus loses on each form the other docked forms will rearrange and every thing going to blast. Because of the question confusion I prepared a set of images to show the reaction.

Image1的,点击任何形式之前:

Image1, Before click on any form:

IMAGE2 ,点击后W2:

Image2, After click on W2:

所不同的是,当最左边停靠窗口获得焦点,它会改变它的大小为MDI窗口的到底对不对不提W1窗口。

The difference is when the most left hand side docked window get focus, it'll change its size to the end right of MDI window without mentioning the W1 window.

我怎样才能解决这个问题?谢谢你。

How can I fix this problem? Thanks.

推荐答案

有另外一个修复此。一个非常快速的例子是:

There's another fix for this. A very fast example would be:


  • 创建一个新的Windows窗体(Form1)。其isMidiContainer属性设置为true。

  • 现在,上拖放一个面板(面板1)和它的Dock属性设置为正确的,然后设置你的宽度。

  • 挂断窗体上的另一个面板(是Panel2)和它的码头设置为正确的为好。现在,这两个板码头相邻。

现在创建两个新的Windows窗体(表2和Form3)。

Now create 2 new windows forms (Form 2 and Form3).

现在,在Form1的主,只是下面的InitializeComponent(),地址:

Now, in Form1's main, just underneath InitializeComponent(), add:

Form2 f2 = new Form2();
f2.TopLevel = false;
f2.Dock = DockStyle.Fill;
panel1.Controls.Add(f2);
f2.Show();

Form3 f3 = new Form3();
f3.TopLevel = false;
f3.Dock = DockStyle.Fill;
panel2.Controls.Add(f3);
f3.Show();

这是一个有点不同的方法,但它应该工作得很好。

This is a little different approach but it should work just fine.

这篇关于子窗口对接MDI窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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