当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET Stroke.OnInvalidated方法代码示例

本文整理汇总了VB.NET中System.Windows.Ink.Stroke.OnInvalidated方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Stroke.OnInvalidated方法的具体用法?VB.NET Stroke.OnInvalidated怎么用?VB.NET Stroke.OnInvalidated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。


在下文中一共展示了Stroke.OnInvalidated方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1:

' Enumerator that specifies the drawing mode of the stroke.

Public Enum DrawingMode
    Solid
    StyulusPoints
End Enum 'DrawingMode
开发者ID:VB.NET开发者,项目名称:System.Windows.Ink,代码行数:6,代码来源:Stroke.OnInvalidated

示例2: DrawCore

Private strokeMode As DrawingMode = DrawingMode.Solid

' Property that specifies whether to draw a solid stroke or the stylus points
Public Property Mode() As DrawingMode

    Get
        Return strokeMode
    End Get

    Set(ByVal value As DrawingMode)
        If strokeMode <> value Then
            strokeMode = value
            Me.OnInvalidated(New EventArgs())
        End If
    End Set

End Property


Protected Overrides Sub DrawCore(ByVal context As System.Windows.Media.DrawingContext, _
            ByVal overridedAttributes As DrawingAttributes)
    Dim strokeBrush As New SolidColorBrush(overridedAttributes.Color)

    ' If strokeMode it set to Solid, draw the strokes regularly.
    ' Otherwise, draw the stylus points.
    If strokeMode = DrawingMode.Solid Then
        Dim geometry As Geometry = GetGeometry(overridedAttributes)
        context.DrawGeometry(strokeBrush, Nothing, geometry)
        ' strokeMode == DrawingMode.StylusPoints
    Else
        Dim points As StylusPointCollection

        ' Get the stylus points used to draw the stroke.  The points used depends on
        ' the value of FitToCurve.
        If Me.DrawingAttributes.FitToCurve Then
            points = Me.GetBezierStylusPoints()
        Else
            points = Me.StylusPoints
        End If

        ' Draw a circle at each stylus point.
        Dim p As StylusPoint
        For Each p In points
            context.DrawEllipse(Nothing, New Pen(strokeBrush, 1), CType(p, Point), 5, 5)
        Next p
    End If

End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Ink,代码行数:48,代码来源:Stroke.OnInvalidated


注:本文中的System.Windows.Ink.Stroke.OnInvalidated方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。