刷新具有嵌套属性的控件的设计。VB.Net
我试图创建一个嵌套属性,重新绘制其父属性的基(控件) 以下是我所知道的: 如果我们使用Refresh()命令,应该可以满足我的需要。就像下面一样刷新具有嵌套属性的控件的设计。VB.Net,vb.net,properties,boost-propertytree,propertyinfo,Vb.net,Properties,Boost Propertytree,Propertyinfo,我试图创建一个嵌套属性,重新绘制其父属性的基(控件) 以下是我所知道的: 如果我们使用Refresh()命令,应该可以满足我的需要。就像下面一样 Private Var_MyProperties_Parent As Integer Public Property MyProperties_Parent As Integer Get Return Var_MyProperties_Parent End Get Set(value As Class_Chil
Private Var_MyProperties_Parent As Integer
Public Property MyProperties_Parent As Integer
Get
Return Var_MyProperties_Parent
End Get
Set(value As Class_Child)
Var_MyProperties_Parent = value
Refresh()
End Set
End Property
Imports System.ComponentModel
Imports System.Globalization
Public Class Class_ParentProperty_1 : Inherits Control
Private Var_MyProperties_Parent As New Class_Child
<Browsable(True)>
<Description("Descrição não é necessária."), Category("Appearance")> ' Categoria da propriedade
<EditorBrowsable(EditorBrowsableState.Always)>
<RefreshProperties(RefreshProperties.Repaint)>
Public Property MyProperties_Parent As Class_Child
Get
Return Var_MyProperties_Parent
End Get
Set(value As Class_Child)
Var_MyProperties_Parent = value
Refresh()
End Set
End Property
Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
MyBase.BackColor = MyProperties_Parent.TheMyColor
MyBase.BackgroundImage = MyProperties_Parent.SimpleImage
End Sub
End Class
<TypeConverter(GetType(Class_Child))>
Public Class Class_Child : Inherits ExpandableObjectConverter
<RefreshProperties(RefreshProperties.Repaint)>
Private Var_TheMyColor As Color = Color.Crimson
<RefreshProperties(RefreshProperties.Repaint)>
Private Var_SimpleImage As Image
<RefreshProperties(RefreshProperties.Repaint)>
Private Var_ANumber As Integer
<RefreshProperties(RefreshProperties.Repaint)>
Public Property TheMyColor As Color
Get
Return Var_TheMyColor
End Get
Set(value As Color)
Var_TheMyColor = value
End Set
End Property
<RefreshProperties(RefreshProperties.Repaint)>
Public Property SimpleImage As Image
Get
Return Var_SimpleImage
End Get
Set(value As Image)
Var_SimpleImage = value
End Set
End Property
<RefreshProperties(RefreshProperties.Repaint)>
Public Property ANumber As Integer
Get
Return Var_ANumber
End Get
Set(value As Integer)
Var_ANumber = value
End Set
End Property
Public Overrides Function ToString() As String
Return Nothing
End Function
End Class
但是,如果我尝试在嵌套属性上使用它,它将不起作用,如下所示
Private Var_MyProperties_Parent As Integer
Public Property MyProperties_Parent As Integer
Get
Return Var_MyProperties_Parent
End Get
Set(value As Class_Child)
Var_MyProperties_Parent = value
Refresh()
End Set
End Property
Imports System.ComponentModel
Imports System.Globalization
Public Class Class_ParentProperty_1 : Inherits Control
Private Var_MyProperties_Parent As New Class_Child
<Browsable(True)>
<Description("Descrição não é necessária."), Category("Appearance")> ' Categoria da propriedade
<EditorBrowsable(EditorBrowsableState.Always)>
<RefreshProperties(RefreshProperties.Repaint)>
Public Property MyProperties_Parent As Class_Child
Get
Return Var_MyProperties_Parent
End Get
Set(value As Class_Child)
Var_MyProperties_Parent = value
Refresh()
End Set
End Property
Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
MyBase.BackColor = MyProperties_Parent.TheMyColor
MyBase.BackgroundImage = MyProperties_Parent.SimpleImage
End Sub
End Class
<TypeConverter(GetType(Class_Child))>
Public Class Class_Child : Inherits ExpandableObjectConverter
<RefreshProperties(RefreshProperties.Repaint)>
Private Var_TheMyColor As Color = Color.Crimson
<RefreshProperties(RefreshProperties.Repaint)>
Private Var_SimpleImage As Image
<RefreshProperties(RefreshProperties.Repaint)>
Private Var_ANumber As Integer
<RefreshProperties(RefreshProperties.Repaint)>
Public Property TheMyColor As Color
Get
Return Var_TheMyColor
End Get
Set(value As Color)
Var_TheMyColor = value
End Set
End Property
<RefreshProperties(RefreshProperties.Repaint)>
Public Property SimpleImage As Image
Get
Return Var_SimpleImage
End Get
Set(value As Image)
Var_SimpleImage = value
End Set
End Property
<RefreshProperties(RefreshProperties.Repaint)>
Public Property ANumber As Integer
Get
Return Var_ANumber
End Get
Set(value As Integer)
Var_ANumber = value
End Set
End Property
Public Overrides Function ToString() As String
Return Nothing
End Function
End Class
导入System.ComponentModel
进口系统.全球化
公共类类\u ParentProperty\u 1:继承控件
私有变量\u MyProperties\u父类作为新类\u子类
“固有范畴
公共属性MyProperties\u父级作为类\u子级
得到
返回Var\u MyProperties\u父项
结束
设置(值为类\子项)
Var\u MyProperties\u Parent=值
刷新()
端集
端属性
受保护的覆盖子OnPaint(如PaintEventArgs)
MyBase.OnPaint(e)
MyBase.BackColor=MyProperties\u Parent.TheMyColor
MyBase.BackgroundImage=MyProperties\u Parent.SimpleImage
端接头
末级
公共类类\子类:继承ExpandableObjectConverter
Private Var_TheMyColor As Color=Color.Crimson
私有Var_SimpleImage作为映像
私有变量数为整数
公共财产主题颜色作为颜色
得到
返回色差
结束
设置(值为颜色)
Var_TheMyColor=值
端集
端属性
公共财产形象化
得到
返回Var_SimpleImage
结束
设置(值为图像)
Var_SimpleImage=值
端集
端属性
作为整数的公共属性数
得到
返回变量数
结束
设置(值为整数)
Var_ANumber=值
端集
端属性
Public将函数ToString()重写为字符串
一无所获
端函数
末级
如果有人可以替代我,或者有人可以解释我如何用其他方式思考,我会非常感激