本文整理汇总了VB.NET中System.Windows.Ink.DrawingAttributes.PropertyDataChanged事件的典型用法代码示例。如果您正苦于以下问题:VB.NET DrawingAttributes.PropertyDataChanged事件的具体用法?VB.NET DrawingAttributes.PropertyDataChanged怎么用?VB.NET DrawingAttributes.PropertyDataChanged使用的例子?那么恭喜您, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在类System.Windows.Ink.DrawingAttributes
的用法示例。
在下文中一共展示了DrawingAttributes.PropertyDataChanged事件的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ShadowedStroke
Class ShadowedStroke
Inherits Stroke
Private shadow As New Guid("12345678-9012-3456-7890-123456789012")
Public Sub New(ByVal stylusPoints As StylusPointCollection, ByVal drawingAttributes As DrawingAttributes)
MyBase.New(stylusPoints, drawingAttributes)
AddHandler Me.DrawingAttributes.PropertyDataChanged, AddressOf DrawingAttributes_PropertyDataChanged
End Sub
Public Property Shadowed() As Boolean
' Return the value of the custom property, shadow.
' If there is no custom property, return false.
Get
If Not Me.DrawingAttributes.ContainsPropertyData(shadow) Then
Return False
End If
Dim propertyData As Object = Me.DrawingAttributes.GetPropertyData(shadow)
If TypeOf propertyData Is Boolean Then
Return CType(propertyData, Boolean)
Else
Return False
End If
End Get
' Set the value of the custom property.
Set
Me.DrawingAttributes.AddPropertyData(shadow, value)
End Set
End Property
Private Sub DrawingAttributes_PropertyDataChanged(ByVal sender As Object, ByVal e As PropertyDataChangedEventArgs)
Me.OnInvalidated(New EventArgs())
End Sub
Protected Overrides Sub DrawCore(ByVal context As System.Windows.Media.DrawingContext, _
ByVal overriddenAttributes As DrawingAttributes)
' create a drop shadow
'
If Me.Shadowed Then
Dim pathGeometry As Geometry = Me.GetGeometry(overriddenAttributes).Clone()
pathGeometry.Transform = New TranslateTransform(5, 0)
Try
context.PushOpacity(0.5)
context.DrawGeometry(Brushes.DarkGray, Nothing, pathGeometry)
Finally
context.Pop()
End Try
End If
MyBase.DrawCore(context, overriddenAttributes)
End Sub
End Class