This documentation is archived and is not being maintained.

StylusTip Enumeration

Specifies the tip to be used to draw a Stroke.

Namespace:  System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public enum 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.

InkCanvas inkCanvas1 = new InkCanvas();
DrawingAttributes inkDA;
DrawingAttributes highlighterDA;
bool useHighlighter = 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 void WindowLoaded(object sender, EventArgs e)
    inkCanvas1.Background = Brushes.DarkSlateBlue;
    inkCanvas1.DefaultDrawingAttributes.Color = Colors.SpringGreen;


    // Set up the DrawingAttributes for the pen.
    inkDA = new DrawingAttributes();
    inkDA.Color = Colors.SpringGreen;
    inkDA.Height = 5;
    inkDA.Width = 5;
    inkDA.FitToCurve = false;

    // Set up the DrawingAttributes for the highlighter.
    highlighterDA = new DrawingAttributes();
    highlighterDA.Color = Colors.Orchid;
    highlighterDA.IsHighlighter = true;
    highlighterDA.IgnorePressure = true;
    highlighterDA.StylusTip = StylusTip.Rectangle;
    highlighterDA.Height = 30;
    highlighterDA.Width = 10;

    inkCanvas1.DefaultDrawingAttributes = inkDA;

// 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. 
void SwitchHighlighter_Click(Object sender, RoutedEventArgs e)
    useHighlighter = !useHighlighter;

    if (useHighlighter)
        switchHighlighter.Content = "Use Pen";
        inkCanvas1.DefaultDrawingAttributes = highlighterDA;
        switchHighlighter.Content = "Use Highlighter";
        inkCanvas1.DefaultDrawingAttributes = inkDA;


Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

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

.NET Framework

Supported in: 3.5, 3.0