Cursor.Inverted Property
Gets a value that indicates whether the cursor is the inverted end of the pen.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public ReadOnly Property Inverted As Boolean
'Usage
Dim instance As Cursor
Dim value As Boolean
value = instance.Inverted
public bool Inverted { get; }
public:
property bool Inverted {
bool get ();
}
/** @property */
public boolean get_Inverted ()
public function get Inverted () : boolean
Not applicable.
Property Value
true if the cursor is the inverted end of the pen; false if the cursor is not the inverted end of the pen, or the pen does not support a cursor associated with the inverted end of the pen.
Remarks
Inverted cursors are generally associated with erasing, so a known pen might have one end that is intended to draw ink and another end that is intended to erase strokes. However, behavior for when the system recognizes the inverted end of the pen is not limited to erasing. You may associate any acceptable cursor behavior with the Inverted property.
For more information about erasing ink, see Erasing Ink with the Pen.
Note
Whether or not you use the Inverted property is entirely up to the needs of your application. Applications are not required to inspect inverted cursors, and the ink collector applies default drawing attributes to inverted cursors just as it does to cursors that are not inverted.
Note
This function can be re-entered if called within certain message handlers, causing unexpected results. Take care to avoid a reentrant call when handling any of the following messages: WM_ACTIVATE, WM_ACTIVATEAPP, WM_NCACTIVATE, WM_PAINT; WM_SYSCOMMAND if wParam is set to SC_HOTKEY or SC_TASKLIST; and WM_SYSKEYDOWN (when processing Alt-Tab or Alt-Esc key combinations). This is an issue with single-threaded apartment model applications.
Example
This C# example returns a report on the attributes of all of the cursors that are encountered by the InkCollector object passed in as a parameter.
using Microsoft.Ink;
//. . .
public string CursorReport(InkCollector theInkCollector)
{
string theReport = "The InkCollector has encountered the following cursors so far:" + Environment.NewLine;
// Get the Cursors collection from the InkCollector
Microsoft.Ink.Cursors theCursors = theInkCollector.Cursors;
// Prevent changes to the collection while we iterate over it.
lock( theCursors.SyncRoot )
{
theReport += "Count of cursors: " + theCursors.Count + Environment.NewLine + Environment.NewLine ;
foreach (Microsoft.Ink.Cursor cursor in theCursors)
{
theReport += "Cursor Name: " + cursor.Name + Environment.NewLine ;
theReport += "Cursor ToString: " + cursor.ToString() + Environment.NewLine ;
theReport += "Tablet Name: " + cursor.Tablet.Name + Environment.NewLine ;
theReport += "Cursor Id: " + cursor.Id.ToString() + Environment.NewLine ;
theReport += "Cursor is inverted: " + cursor.Inverted.ToString() + Environment.NewLine ;
theReport += "Cursor Buttons:" + Environment.NewLine;
foreach (CursorButton button in cursor.Buttons)
{
CursorButtonState theState = button.State;
theReport += " Button Name: " + button.Name + Environment.NewLine ;
theReport += " State: " + button.State.ToString() + Environment.NewLine ;
theReport += " Id: " + button.Id.ToString() + Environment.NewLine + Environment.NewLine;
}
}
}
return theReport;
}
This Microsoft® Visual Basic® .NET example returns a report on the attributes of all of the cursors that are encountered by the InkCollector object passed in as a parameter.
Imports Microsoft.Ink
'. . .
Public Function CursorReport(ByVal theInkCollector As InkCollector) _
As String
Dim theReport As String = "The InkCollector has encountered " & _
"the following cursors so far:" & vbCrLf
' Get the Cursors collection from the InkCollector
Dim theCursors As Cursors = theInkCollector.Cursors
' Prevent changes to the collection while we iterate over it.
SyncLock theCursors.SyncRoot
theReport &= "Count of cursors: " & theCursors.Count & vbCrLf
Dim theCursor As Cursor
For Each theCursor In theCursors
theReport &= "Cursor Name: " & theCursor.Name & vbCrLf
theReport &= "Cursor ToString: " & theCursor.ToString() & _
vbCrLf
theReport &= "Tablet Name: " & theCursor.Tablet.Name & vbCrLf
theReport &= "Cursor Id: " & theCursor.Id.ToString() & vbCrLf
theReport &= "Cursor is inverted: " & _
theCursor.Inverted.ToString() & vbCrLf
theReport &= "Cursor Buttons:" & vbCrLf
Dim theButton As CursorButton
For Each theButton In theCursor.Buttons
Dim theState As CursorButtonState = theButton.State
theReport &= " Button Name: " & theButton.Name & vbCrLf
theReport &= " State: " & _
theButton.State.ToString() & vbCrLf
theReport &= " Id: " & theButton.Id.ToString() & _
vbCrLf & vbCrLf
Next
Next
End SyncLock
Return theReport
End Function
Platforms
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.
Version Information
.NET Framework
Supported in: 3.0
See Also
Reference
Cursor Class
Cursor Members
Microsoft.Ink Namespace
DrawingAttributes