从(自定义)控件共享(容器)控件?

发布于 2024-09-28 17:31:33 字数 375 浏览 0 评论 0 原文

Soo...我正在制作一个类似 Windows 更新“面板”的控件。
直到“容器”部分一切都很好。
我想要做的是允许设计者将控件放置在我的控件内的 Panel 中。
(面板的变量保存在我的控件的类中以及控件本身的内部。)

如何绕过这个?

作为参考,您可能想要尝试这个 AeroWizard Control,它可以执行此操作很好。
(是的,我看过它,除了定制设计师之外没有找到任何线索!)

作为旁注,我宁愿创建一个复杂的设计师类......

Soo... I am making a control like the Windows Update "panels".
Everything's fine up to the "container" part.
What I want to do is to allow the designer to place controls in a Panel which is inside my control.
(The panel's variable is held in my control's class and inside the control itself.)

How do I bypass this?

As a reference, you might want to try out this AeroWizard Control, which does this pretty well.
(Yes, I have looked at it and didn't find a clue but custom designers!)

As a side note, I'd rather not make a complicated designer class...

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

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

发布评论

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

评论(1

蝶舞 2024-10-05 17:31:33

如果您不想创建自定义设计器类,则应将控件实现为 模板化自定义控件,最好继承自CompositeControl

如果没有自定义设计器类,似乎没有办法在 Windows 窗体中执行相同的操作。然而,这样的设计器有一个很好的、简短的、有效的示例此处

If you don't want to create a custom designer class, you should implement your control as a templated custom control, preferably inheriting from CompositeControl.

There doesn't seem to be a way to do the same in Windows Forms without a custom designer class. However, there's a nice, short, working example of such a designer here.

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