本文整理汇总了VB.NET中System.ComponentModel.NotifyParentPropertyAttribute类的典型用法代码示例。如果您正苦于以下问题:VB.NET NotifyParentPropertyAttribute类的具体用法?VB.NET NotifyParentPropertyAttribute怎么用?VB.NET NotifyParentPropertyAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NotifyParentPropertyAttribute类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: New
' 导入命名空间
Imports System.ComponentModel
Imports System.Drawing
Imports System.Globalization
Imports System.Windows.Forms
Public Class DemoControl
Inherits UserControl
Private borderAppearanceValue As New BorderAppearance()
Private components As System.ComponentModel.IContainer = Nothing
Public Sub New()
InitializeComponent()
End Sub
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
<Browsable(True), _
EditorBrowsable(EditorBrowsableState.Always), _
Category("Demo"), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
Public Property Border() As BorderAppearance
Get
Return Me.borderAppearanceValue
End Get
Set(ByVal value As BorderAppearance)
Me.borderAppearanceValue = value
End Set
End Property
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
End Sub
End Class
<TypeConverter(GetType(BorderAppearanceConverter))> _
Public Class BorderAppearance
Private borderSizeValue As Integer = 1
Private borderColorValue As Color = Color.Empty
<Browsable(True), NotifyParentProperty(True), EditorBrowsable(EditorBrowsableState.Always), DefaultValue(1)> _
Public Property BorderSize() As Integer
Get
Return borderSizeValue
End Get
Set
If value < 0 Then
Throw New ArgumentOutOfRangeException("BorderSize", value, "must be >= 0")
End If
If borderSizeValue <> value Then
borderSizeValue = value
End If
End Set
End Property
<Browsable(True), NotifyParentProperty(True), EditorBrowsable(EditorBrowsableState.Always), DefaultValue(GetType(Color), "")> _
Public Property BorderColor() As Color
Get
Return borderColorValue
End Get
Set
If value.Equals(Color.Transparent) Then
Throw New NotSupportedException("Transparent colors are not supported.")
End If
If borderColorValue <> value Then
borderColorValue = value
End If
End Set
End Property
End Class
Public Class BorderAppearanceConverter
Inherits ExpandableObjectConverter
' This override prevents the PropertyGrid from
' displaying the full type name in the value cell.
Public Overrides Function ConvertTo(ByVal context As ITypeDescriptorContext, ByVal culture As CultureInfo, ByVal value As Object, ByVal destinationType As Type) As Object
If destinationType Is GetType(String) Then
Return ""
End If
Return MyBase.ConvertTo(context, culture, value, destinationType)
End Function
End Class
开发者ID:VB.NET开发者,项目名称:System.ComponentModel,代码行数:106,代码来源:NotifyParentPropertyAttribute
注:本文中的System.ComponentModel.NotifyParentPropertyAttribute类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论