LEADTOOLS Support
Document
Document SDK Examples
How to: Change Cursors with Annotations Core
#1
Posted
:
Tuesday, January 31, 2017 3:06:23 PM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
For those of you who wishing to change a default cursor with your .NET Annotations Core application, this can be done easily by modifying the GetAutomationObjectCursor() method in AutomationManagerHelper.cs. This can be found in the Leadtools.Annotations.WinForms or Leadtools.Annotations.Wpf example project.
A couple specific annotations objects are handled first. Most annotations will have their cursors returned by one of the following two lines:
Code:
return new Cursor(typeof(AutomationManagerHelper), resourceName);
Code:
return GetCursorFromResource(resourceName);
Here, I want to change the text redaction annotation to use the same draw cursor as the [raster] redaction annotation. I know that all of the cursor resources are located in a resources directory within the project, and the cursor I want is located here:
Resources\Cursors\Draw\ToolRedaction.cur
Here's how I changed the code in the WinForms project:
Code:
if (objectId == AnnObject.TextHiliteObjectId ||
objectId == AnnObject.TextStrikeoutObjectId ||
objectId == AnnObject.TextUnderlineObjectId /*||
objectId == AnnObject.TextRedactionObjectId*/)
return Cursors.IBeam;
if (objectId == AnnObject.TextRedactionObjectId)
return new Cursor(typeof(AutomationManagerHelper),"Resources.Cursors.Draw.ToolRedaction.cur");
And here's how I changed the WPF project:
Code:
if (objectId == AnnObject.TextHiliteObjectId ||
objectId == AnnObject.TextStrikeoutObjectId ||
objectId == AnnObject.TextUnderlineObjectId /*||
objectId == AnnObject.TextRedactionObjectId*/)
return Cursors.IBeam;
if (objectId == AnnObject.TextRedactionObjectId)
return GetCursorFromResource("Resources/Cursors/Draw/ToolRedaction.cur");
Happy coding!
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Examples
How to: Change Cursors with Annotations Core
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.