Windows apps
Collapse the table of content
Expand the table of content
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.

Stylus.StylusInRange Attached Event

Occurs when the stylus comes within range of the tablet.

Namespace: System.Windows.Input
Assembly: PresentationCore (in PresentationCore.dll)
XML Namespace:

See Stylus.AddStylusInRangeHandler, Stylus.RemoveStylusInRangeHandler
See Stylus.AddStylusInRangeHandler, Stylus.RemoveStylusInRangeHandler
See Stylus.AddStylusInRangeHandler, Stylus.RemoveStylusInRangeHandler
<object Stylus.StylusInRange="StylusEventHandler" .../>

The following example demonstrates how to set the EditingMode property of an InkCanvas to EraseByStroke when the stylus is inverted. This example assumes that there is an InkCanvas called inkCanvas1 and that the StylusInRange event is connected to the event handlers. To see the cursor change, set the UseCustomCursor property to true on inkCanvas1.

void inkCanvas1_StylusInRange(object sender, StylusEventArgs e)
    if (e.StylusDevice.Inverted == true)
        inkCanvas1.EditingMode = InkCanvasEditingMode.EraseByStroke;
        inkCanvas1.Cursor = System.Windows.Input.Cursors.Hand;
        inkCanvas1.EditingMode = InkCanvasEditingMode.Ink;
        inkCanvas1.Cursor = System.Windows.Input.Cursors.Pen;

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Community Additions

© 2016 Microsoft