从孩子的调整大小事件调整父控件的大小 [英] Resize parent control from child's resize event

查看:23
本文介绍了从孩子的调整大小事件调整父控件的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始为我公司的一个应用程序更新 UI,但我遇到了一个棘手的问题.父控件包含多个面板,每个面板都可以根据用户输入打开或关闭.

I'm starting work updating an UI for one of my company's applications and I'm running into a sticky issue. The parent control contains several panels, each of which can be turned on or off depending on user input.

用户控件中的最后一个面板包含另一个用户控件,它根据切换开关调整大小.本质上,它打开"了更多信息.

The final panel in the user control contains another user control which gets resizes according to a toggle switch. Essentially, it "opens" up more information.

虽然子控件 (ChildControl) 停靠在父控件 (ParentControl) 内的 Fill,但当我向 ChildControl 添加高度时,我也无法更新 ParentControl 的高度.目前我正在处理 ParentControl 中的 ChildControl.Layout 事件,但我似乎无法访问该代码.要调整 ChildControl 的大小,我在 ChildControl.vb 中调用 Me.Height += 200.

While the child control (ChildControl) is docked to Fill inside the parent control (ParentControl), when I add height to ChildControl I can't get ParentControl's height to get updated as well. Currently I'm handling the ChildControl.Layout event in ParentControl but I can't seem to reach that code. To resize ChildControl, I'm calling Me.Height += 200 in ChildControl.vb.

我相信我做错了,但 MSDN 并没有多大帮助.感谢您提供的任何帮助.

I believe I'm doing this wrong, but MSDN isn't being much help. Thanks for any and all help.

推荐答案

尝试 ChildControl.Resize 事件.

我的答案是在 C# 中.但它的工作原理可能相同.

My answer is in C#. But it might work the same.

这篇关于从孩子的调整大小事件调整父控件的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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