Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Tuesday, January 31, 2017 3:06:23 PM(UTC)

Walter  
Walter

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.
LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.037 seconds.