在运行时更改控件的父级 VB.NET

发布于 2024-08-03 05:57:47 字数 213 浏览 3 评论 0原文

我正在制作一个可以拖动的自定义控件,它是半透明的。我需要它,以便在它移动时(mousemove 事件),如果它与一个控件相交,那么它的父控件就会成为该控件。我试图让它遍历所有控件和 if control.bounds.intersectswith me.clientrectangle then me.parent = control type 事情,但它不起作用。任何帮助将不胜感激。

I'm making a custom control that can be dragged around and it is semi transparent. I need it so that while it is moving (the mousemove event) that if it intersects a control that its parent becomes that control. I tried to have it iterate through all the controls and if control.bounds.intersectswith me.clientrectangle then me.parent = control type thing, but it did not work. Any help would be appreciated thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼眸里的那抹悲凉 2024-08-10 05:57:47

由于您同时引用了原始父级和新父级,因此请执行以下操作:

OriginalParent.controls.remove(YourControl)

NewParent.controls.add(YourControl)

Since you have references to both the original parent and the new parent, do the following:

OriginalParent.controls.remove(YourControl)

NewParent.controls.add(YourControl)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文