Inverted Property
Collapse the table of content
Expand the table of content

StylusDevice.Inverted Property

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Gets or sets a value that indicates whether the stylus is inverted.

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

'Declaration
Public ReadOnly Property Inverted As Boolean

Property Value

Type: System.Boolean
true if the stylus is inverted; otherwise, false. The default is false.

For mouse input that is used for ink support instead of a stylus, the Inverted value is always false.

The following code example simulates a stylus that can be used as a highlighter when it is inverted.


'A new stroke object MyStroke is created and is added to the StrokeCollection 
'object of the InkPresenter MyIP
Private Sub MyIP_MouseLeftButtonDown(ByVal sender As Object, ByVal e As MouseEventArgs)
    MyIP.CaptureMouse()
    Dim MyStylusPointCollection As StylusPointCollection = New StylusPointCollection
    MyStylusPointCollection.Add(e.StylusDevice.GetStylusPoints(MyIP))
    MyStroke = New Stroke(MyStylusPointCollection)
    MyStroke.DrawingAttributes = CloneDrawingAttributes(MyDA, e)
    MyIP.Strokes.Add(MyStroke)
End Sub


...


'Set DrawingAttributes based on the stylus status
Private Function CloneDrawingAttributes(ByVal attributes As DrawingAttributes, ByVal e As MouseEventArgs) As DrawingAttributes
    Dim cloneAttribute As DrawingAttributes = New DrawingAttributes
    If (attributes Is Nothing) Then
        Return attributes
    End If
    'Stylus is inverted. So set drawing attributes for a highlighter
    If (e.StylusDevice.Inverted = True) Then
        cloneAttribute.Width = 25
        cloneAttribute.Height = 5
        cloneAttribute.Color = Colors.Yellow
        cloneAttribute.OutlineColor = Colors.Yellow
        Return cloneAttribute
    End If
    'Stylus is not inverted. So set the default drawing attribute.
    cloneAttribute.Color = attributes.Color
    cloneAttribute.Height = attributes.Height
    cloneAttribute.OutlineColor = attributes.OutlineColor
    cloneAttribute.Width = attributes.Width
    Return cloneAttribute
End Function


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft