C#:锚面板将不能正常调整 [英] C#: Anchored Panel won't resize properly

查看:142
本文介绍了C#:锚面板将不能正常调整的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有关于用户控制面板的自动调整大小一个奇怪的问题。该面板固定在用户控件的所有4个方面。
,而锚固并不总是工作,它应该:

I've a strange problem regarding auto sizing of a panel in a user control. This panel is anchored to all 4 sides of the user control. But the anchoring not always works as it should:

如果用户控件通过调整形式调整,右侧和底部锚不起作用。但如果该控制是通过使用分离器这是在形式调整大小,它正常工作。
这也受到正确调整工作的所有其他控件,只是此面板不会做。

If the user control is resized by resizing the form, the right and bottom anchors don't work. But if the control is resized by using a splitter which is in the form, it works correctly. All other controls which are also affected by resizing work correctly, just this panel won't do.

我看不到通过一个分离器,并通过一个形式调整大小之间的差异。

I can't see the difference between resizing through a splitter and through a form.

设定尺寸手动在该用户的onResize受到只有在调整大小通过移动分离器进行工作。如果通过调整形式出现调整大小时,heigth和面板的宽度不会更改为新值

Setting the size manually in the OnResize of the UserControl only works if the resizing is done by moving the splitter. If the resizing occurs by resizing the form, the heigth and the width of the panel won't change to the new values.

编辑:为了更清楚:该。用户控件添加到一个TabPage的,并设置码头= DockType.Fill

To make it more clear: The user control is added to a TabPage and set to Dock=DockType.Fill.

EDIT2:为了使问题更加复杂:这是用来控制层级:
表单包含2个控制器(A和b)分离器。 (B)含有用SplitContainer的用户对照(C)。 (C)中拆分盛器> PANEL1包含一个TabControl(D)。这TabControl的(D)包含一个用户控件(E)(在TabPage的)。这个用户控件(E)具有在同一个TabControl(G)另一个用户控件放置在SplitContainer的(F)。此的tabcontrol(G)具有的TabPages,并且在该网页是放置在所述用户控制装置(H)。

To make it more complicated: This is the hierarchy the control is used: The Form contains a splitter with 2 controls (A and B). (B) contains a user control (C) with a splitContainer. The split container->panel1 in (C) contains a tabcontrol (D). This tabcontrol (D) contains a user control (E) (in a tabpage) . This user control (E) has a splitcontainer (F) in which another usercontrol with a tabControl (G) is placed. This tabcontrol (G) has tabpages, and in this pages is the described user control (H) placed.

如果我把控制(H)直接在SplitContainer中(C)一切面板工作正常。由于这些被添加到一个SplitContainer中或TabPage的所有控件都设置为docktype =补,我不明白为什么最后的控制有这个问题。

If I place the control (H) directly to the panel in the splitcontainer (C) everything works fine. Since all controls which are added to a splitcontainer or a tabpage are set to docktype=fill, I cannot see why the last control has this problems.

是否有任何限制Windows窗体框架,这限制了子控件的金额

Is there any limitation in the Windows Forms framework which limits the amount of child controls?

编辑:我已上载与您可以重现这个问题TestApplication。
http://rapidshare.de/files/49092516/TestApplication.zip.html
检查只能在Vista下发生。 Win XP的和7个能正常工作...
如果调整的形式,用...按钮不会调整文本框,但如果你通过垂直SplitContainer的调整,它的工作原理。

I have uploaded a TestApplication with which you can reproduce this issue. http://rapidshare.de/files/49092516/TestApplication.zip.html It occurs only under Vista. Win XP and 7 work properly... If you resize the form, the textBox with the "..." button won't resize, but if you resize via the vertical splitContainer, it works.

推荐答案

有与深嵌套,内核运行的堆栈空间不足引起调整,对接和固定默默地失败的错误。

There is a bug with deep nesting where the kernel runs out of stack space causing resizing, docking and anchoring to fail silently.

请参阅 http://support.microsoft.com/kb/953934

这篇关于C#:锚面板将不能正常调整的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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