VintaSoft Annotation .NET Plug-in Discussions

Questions, comments and suggestions concerning VintaSoft Annotation .NET Plug-in.

Board index < VintaSoft Imaging < VintaSoft Annotation .NET Plug-in Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)



Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by markdhem »

Hi Alex

I want to draw on a AnnotationViewer a

RulerAnnotation from PointF(0,0) to PointF(500,0) programmatically.

Best Regards
Mark


Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by Alex »

Hi Mark,
I want to draw on a AnnotationViewer a
RulerAnnotation from PointF(0,0) to PointF(500,0) programmatically.
You can set the start point of ruler annotation (line-based annotation) using the LineAnnotationData.StartPoint property:
https://www.vintasoft.com/docs/vsimagin ... Point.html

You can set the end point of ruler annotation (line-based annotation) using the LineAnnotationData.EndPoint property:
https://www.vintasoft.com/docs/vsimagin ... Point.html

Please read about the annotation's coordinate system and units of measure here:
https://www.vintasoft.com/docs/vsimagin ... _Data.html

Best regards, Alexander


Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by markdhem »

Hi Alex,

I read the documentation but still I don't get it, can you show me an example or a hint about this?



Best regards

Mark


Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by Alex »

Here is code snippet that shows how to add the ruler annotation with coordinates (0;0)-(0;500) to the image in annotation viewer:
// create an image
Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage(1000, 1000);
// add the image to the annotation viewer
annotationViewer1.Images.Add(image);


// create the ruler annotation
Vintasoft.Imaging.Annotation.RulerAnnotationData rulerAnnotationData = new Vintasoft.Imaging.Annotation.RulerAnnotationData();

// coordinate in pixels
float coordinateInPixels = 500;
// coordinate in DIP (device independent pixels)
float coordinateInDips = coordinateInPixels * 96 / image.Resolution.Horizontal;
// set the ruler coordinates
rulerAnnotationData.StartPoint = new System.Drawing.PointF(0, 0);
rulerAnnotationData.EndPoint = new System.Drawing.PointF(0, coordinateInDips);

// add the ruler annotation to the image in annotation viewer
int imageIndex = 0;
annotationViewer1.AnnotationDataController[imageIndex].Add(rulerAnnotationData);
Best regards, Alexander


Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by markdhem »

Hi Alex,

This works perfectly. Thanks a lot, but I still have a problem, when I have a multiple pages and when I go to the
second page and click the button it will draw at page 1.

Regards

Mark


Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by Alex »

You need to set the correct image index when you selecting the annotation collection:
...
// add the ruler annotation to the image in annotation viewer
int imageIndex = 0;
annotationViewer1.AnnotationDataController[imageIndex].Add(rulerAnnotationData);
Best regards, Alexander


Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by markdhem »

Hi Alex,

I still don't know how to select the Current Page.
Please give me an example. Thank you

Mark


Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)

Post by Alex »

Hello Mark,

The focused image in image viewer can be changed using the ImageViewer.FocusedIndex property:
https://www.vintasoft.com/docs/vsimagin ... Index.html

More info about image viewer please read here:
https://www.vintasoft.com/docs/vsimagin ... Forms.html

Best regards, Alexander


Page 1 from 1: 1