Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

StylusTip Enumeration

Specifies the tip to be used to draw a Stroke.

Namespace:  System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

'Declaration
Public Enumeration StylusTip
This class is not typically used in XAML.

Member nameDescription
RectangleRepresents a rectangle-shaped tip.
EllipseRepresents an ellipse-shaped tip.

You can specify the shape of the tip that is used to draw Stroke objects by setting the DrawingAttributes.StylusTip property.

The following example demonstrates how to use two DrawingAttributes objects to simulate using a pen and a highlighter on the same InkCanvas. The highlighter's StylusTip property is set to Rectangle.

The example assumes the root element in the "XAML" file is a DockPanel called root. It also assumes that there is a Button called btnToggleHilighter and that the Click event has been connected to the event handler.


    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 'WindowLoaded


    ' 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 'SwitchHighlighter_Click



.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

Show:
© 2017 Microsoft