如何将usercontrol的属性集成到表单的属性中? [英] How can I integrate usercontrol's properties into form's properties?
本文介绍了如何将usercontrol的属性集成到表单的属性中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了自定义表单和 UserControl ,其行为类似于自定义表单的标题栏。我想要实现的是将 UserControl的属性集成到自定义表单的属性中。像嵌套属性的东西。
我尝试过:
Something例如 this 。这里我们将 Button 的属性集成到 TextBox 的属性中。任何想法我该怎么做?
I have create a custom form and a UserControl which acts like custom form's title bar. What I want to achieve, is to integrate UserControl's properties into custom form's properties. Something like nested properties.
What I have tried:
Something like this. Here we have Button's properties integrated into TextBox's properties. Any idea how can I do that?
推荐答案
这是如何制作这样一个属性的一种方法 - 将它集成到你的控制代码(Form)中并替换带有UserControl的Button ...
This is one way how such a Property could be made - integrate it into the Code of your Control (Form) and replace the Button with your UserControl ...
<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)>
Property ButtonProperties As Button
Get
Return myButton
End Get
Set(value As Button)
myButton = value
End Set
End Property
Private myButton As New Button
这篇关于如何将usercontrol的属性集成到表单的属性中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文