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 : Sunday, October 9, 2016 3:30:17 AM(UTC)
username77

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

 

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.

#2 Posted : Monday, October 10, 2016 2:05:24 PM(UTC)

Hadi  
Hadi

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

File Attachment(s):
SimpleWinformsAnnotations.zip (11kb) downloaded 294 time(s).

Edited by user Friday, July 31, 2020 6:59:53 PM(UTC)  | Reason: Not specified

Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
#3 Posted : Monday, October 10, 2016 4:15:55 PM(UTC)
username77

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-vector


Thanks for your help!
 
#4 Posted : Tuesday, October 11, 2016 4:13:56 PM(UTC)

Hadi  
Hadi

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:

demo screenshot

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:
File Attachment(s):
LEADTOOLS Barcode Annotation Demo.zip (12kb) downloaded 298 time(s).
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 
#5 Posted : Sunday, April 16, 2017 9:30:15 PM(UTC)
wangbill18

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)

Hadi  
Hadi

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.

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