本文整理汇总了VB.NET中System.Windows.Controls.InkCanvas.DefaultDrawingAttributes属性的典型用法代码示例。如果您正苦于以下问题:VB.NET InkCanvas.DefaultDrawingAttributes属性的具体用法?VB.NET InkCanvas.DefaultDrawingAttributes怎么用?VB.NET InkCanvas.DefaultDrawingAttributes使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Windows.Controls.InkCanvas
的用法示例。
在下文中一共展示了InkCanvas.DefaultDrawingAttributes属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: WindowLoaded
Private WithEvents inkCanvas1 As New InkCanvas()
Private inkDA As DrawingAttributes
Private highlighterDA As DrawingAttributes
Private useHighlighter As Boolean = False
' Add an InkCanvas to the window, and allow the user to
' switch between using a green pen and a purple highlighter
' on the InkCanvas.
Private Sub WindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
inkCanvas1.Background = Brushes.DarkSlateBlue
inkCanvas1.DefaultDrawingAttributes.Color = Colors.SpringGreen
' Add the InkCanvas to the DockPanel, named root.
root.Children.Add(inkCanvas1)
' Set up the DrawingAttributes for the pen.
inkDA = New DrawingAttributes()
With inkDA
.Color = Colors.SpringGreen
.Height = 5
.Width = 5
.FitToCurve = True
End With
' Set up the DrawingAttributes for the highlighter.
highlighterDA = New DrawingAttributes()
With highlighterDA
.Color = Colors.Orchid
.IsHighlighter = True
.IgnorePressure = True
.StylusTip = StylusTip.Rectangle
.Height = 30
.Width = 10
End With
inkCanvas1.DefaultDrawingAttributes = inkDA
End Sub
' Create a button called switchHighlighter and use
' SwitchHighlighter_Click to handle the Click event.
' The useHighlighter variable is a boolean that indicates
' whether the InkCanvas renders ink as a highlighter.
' Switch between using the 'pen' DrawingAttributes and the
' 'highlighter' DrawingAttributes when the user clicks on .
Private Sub SwitchHighlighter_Click(ByVal sender As [Object], ByVal e As RoutedEventArgs)
useHighlighter = Not useHighlighter
If useHighlighter Then
switchHighlighter.Content = "Use Pen"
inkCanvas1.DefaultDrawingAttributes = highlighterDA
Else
switchHighlighter.Content = "Use Highlighter"
inkCanvas1.DefaultDrawingAttributes = inkDA
End If
End Sub