LEADTOOLS Support
Document
Document SDK FAQ
How do I add the rich text object to my project?
#1
Posted
:
Monday, June 4, 2018 6:56:52 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
An up to date tutorial for creating a custom annotation in a WinForms project can be found here: https://www.leadtools.co...a-custom-annotation.htmlThe following easy steps will add the rich text annotation to the annotation toolbar. It will also tie in the draw and edit designers necessary for creating the annotation and changing it after it has been added to the annotation container. Developers interested in creating their own custom annotations may also find this useful as a guide to see how to integrate other custom objects in with the annotation toolbar and annotation container.
1.) Add the following (existing items) to your WinForms project:
"C:\LEADTOOLS23\Examples\Annotation\DotNet\AnnotationsDemo\src\Common\RichTextObject\AnnRichTextDrawDesigner.cs"
"C:\LEADTOOLS23\Examples\Annotation\DotNet\AnnotationsDemo\src\Common\RichTextObject\AnnRichTextEditDesigner.cs"
"C:\LEADTOOLS23\Examples\Annotation\DotNet\AnnotationsDemo\src\Common\RichTextObject\AnnRichTextObject.cs"
"C:\LEADTOOLS23\Examples\Annotation\DotNet\AnnotationsDemo\src\Common\RichTextObject\AnnRichTextObjectRenderer.cs"
"C:\LEADTOOLS23\Examples\Annotation\DotNet\AnnotationsDemo\src\Common\RichTextObject\RichTextEditor.cs"
"C:\LEADTOOLS23\Examples\Annotation\DotNet\AnnotationsDemo\src\Common\RichTextObject\RichTextMenu\RichTextMenu.cs"
Note: This should automtically pull in the following files as well.
"C:\LEADTOOLS23\Examples\DotNet\CS\AnnotationsDemo\Common\RichTextObject\RichTextMenu\RichTextMenu.designer.cs"
"C:\LEADTOOLS23\Examples\Annotation\DotNet\AnnotationsDemo\src\Common\RichTextObject\RichTextMenu\RichTextMenu.resx"
2.) Before creating the annotation toolbar, add the following code:
Code:Leadtools.Annotations.Automation.AnnAutomationObject automationObj = new Leadtools.Annotations.Automation.AnnAutomationObject(); AnnRichTextObject annRichTextObject = new AnnRichTextObject();
automationObj.Id = annRichTextObject.Id;
automationObj.Name = annRichTextObject.FriendlyName;
automationObj.DrawDesignerType = typeof(Leadtools.Annotations.Designers.AnnRichDrawDesigner);
automationObj.EditDesignerType = typeof(Leadtools.Annotations.Designers.AnnRichTextEditDesigner);
automationObj.ObjectTemplate = annRichTextObject;
automationObj.RunDesignerType = typeof(Leadtools.Annotations.Designers.AnnRunDesigner);
Leadtools.Annotations.Rendering.AnnRichTextObjectRenderer annRichTextObjectRenderer = new Leadtools.Annotations.Rendering.AnnRichTextObjectRenderer();
_automationManager.Objects.Add(automationObj);
IAnnObjectRenderer annNoteObjectRenderer = _automationManager.RenderingEngine.Renderers[AnnObject.NoteObjectId];
annRichTextObjectRenderer.LocationsThumbStyle = annNoteObjectRenderer.LocationsThumbStyle;
annRichTextObjectRenderer.RotateCenterThumbStyle = annNoteObjectRenderer.RotateCenterThumbStyle;
annRichTextObjectRenderer.RotateGripperThumbStyle = annNoteObjectRenderer.RotateGripperThumbStyle;
_automationManager.RenderingEngine.Renderers[AnnObject.RichTextObjectId] = annRichTextObjectRenderer;
Attached here is a LEADTOOLS 20 WinForms project implementing the above steps using the LEADTOOLS Annotations Core framework. To run this project, please extract it to the following directory:
C:\LEADTOOLS 20\Examples\posts\t12528
Edited by moderator Wednesday, December 27, 2023 3:00:29 PM(UTC)
| Reason: Not specified
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK FAQ
How do I add the rich text object to my project?
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.