LEADTOOLS Support
Document
Document SDK Questions
move with mouse the position of non-automated annotations
#1
Posted
:
Sunday, October 9, 2016 3:30:17 AM(UTC)
Groups: Registered
Posts: 40
Thanks: 5 times
Hello,
it's possible to drag the annotation object (similar to design mode on automated annotations)
I'm using windows.form vb.net/c# with latest downloaded demo version
Edited by moderator Friday, July 31, 2020 6:59:39 PM(UTC)
| Reason: Not specified
#2
Posted
:
Monday, October 10, 2016 2:05:24 PM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
Hello,
Thank you for contacting LEADTOOLS Support. The tutorial that you are referencing is the Non-Automated annotations so it does not have the same functionality that the automated annotations have.
I have created and attached a simple Automated annotation demo using Winforms here so that you can download it and get started evaluating.
Please let me know if you have any other questions or issues
Edited by user Friday, July 31, 2020 6:59:53 PM(UTC)
| Reason: Not specified
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#3
Posted
:
Monday, October 10, 2016 4:15:55 PM(UTC)
Groups: Registered
Posts: 40
Thanks: 5 times
Hello Hadi,
I think, I need a non-automated annotation for this type of requirement:
I need to create automatically an AnnotationStampObject with a picture in a certain position of rasterimageviewer. The image on StampObject may be generated with leadtools.barcode such as barcode image or may be printed from an external application to the leadtools virtual printer as barcode image.
I need to move with this Stamp Object, with the mouse by dragging It, if by chance overlaps the images or text that are in raterimageviewer.
And finally, I can use the realize command to burn annotation image over the rasterimage.
On this post I have been advised to use the annotation stamp, but I don't have understood how to do this:
https://www.leadtools.co...pdf-raster-or-pdf-vectorThanks for your help!
#4
Posted
:
Tuesday, October 11, 2016 4:13:56 PM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
If you are just trying to add annotations programmatically while still being able to drag/edit the annotations, then you don't need to use non-automated annotations.
I have written a small sample demo that shows how to use our Automated annotations along with our
BarcodeEngine and
BarcodeWriter classes to write barcodes to a
AnnStampObject.
Here is a screenshot of what the demo looks like:
Here is the relevant code from the sample:
Code to write the barcode to an image:Code:RasterImage barcodeImage = RasterImage.Create(300, 300, 24, 150, RasterColor.White);
LogicalRectangle writebounds = LogicalRectangle.FromLTRB(0, 0, barcodeImage.ImageSize.Width, barcodeImage.ImageSize.Height, LogicalUnit.Pixel);
BarcodeEngine barcodeEngine = new BarcodeEngine();
QRBarcodeData qrData = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.QR) as QRBarcodeData;
qrData.Value = barcodestring;
QRBarcodeWriteOptions options = new QRBarcodeWriteOptions();
options.HorizontalAlignment = BarcodeAlignment.Center;
options.VerticalAlignment = BarcodeAlignment.Center;
barcodeEngine.Writer.CalculateBarcodeDataBounds(writebounds, barcodeImage.XResolution, barcodeImage.YResolution, qrData, options);
barcodeEngine.Writer.WriteBarcode(barcodeImage, qrData, options);
Code to add the Barcode Image to the stamp and the stamp to the Automation programmatically:Code:AnnStampObject stamp = new AnnStampObject();
stamp.Rect = LeadRectD.Create(200, 200, 600, 600);
stamp.Text = "";
stamp.Stroke.Stroke = AnnSolidColorBrush.Create("");
using (MemoryStream ms = new MemoryStream())
using (RasterCodecs codecs = new RasterCodecs())
{
codecs.Save(barcodeImage, ms, RasterImageFormat.Png, 32);
stamp.Picture = new AnnPicture(ms.ToArray());
}
annAutomation.Container.Children.Add(stamp);
annAutomation.InvalidateObject(stamp);
You can download the project here:
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#5
Posted
:
Sunday, April 16, 2017 9:30:15 PM(UTC)
Groups: Registered
Posts: 50
Hi Charmi,
how to show the ContextMenu when annotation is right clicked? so user can change annotation text, size or just delete..
#6
Posted
:
Monday, April 17, 2017 8:29:20 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
In order to have the ContextMenu show when you right click, you will need to subscribe to the OnShowContextMenu event from the Automation like so:
Code: automation.OnShowContextMenu += new EventHandler<AnnAutomationEventArgs>(automation_OnShowContextMenu);
Code:void automation_OnShowContextMenu(object sender, AnnAutomationEventArgs e)
{
if (e != null && e.Object != null)
{
_automationControl.AutomationInvalidate(LeadRectD.Empty);
AnnAutomationObject annAutomationObject = e.Object as AnnAutomationObject;
if (annAutomationObject != null)
{
ObjectContextMenu menu = annAutomationObject.ContextMenu as ObjectContextMenu;
if (menu != null)
{
menu.Automation = sender as AnnAutomation;
menu.Show(this, _viewer.PointToClient(Cursor.Position));
}
}
}
else
{
ManagerContextMenu defaultMenu = new ManagerContextMenu();
defaultMenu.Automation = sender as AnnAutomation;
defaultMenu.Collapse += defaultMenu_Collapse;
defaultMenu.Show(this, _viewer.PointToClient(Cursor.Position));
}
}
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
LEADTOOLS Support
Document
Document SDK Questions
move with mouse the position of non-automated annotations
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.