Hi Alex
I want to draw on a AnnotationViewer a
RulerAnnotation from PointF(0,0) to PointF(500,0) programmatically.
Best Regards
Mark
Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
Moderator: Alex
-
- Posts: 6
- Joined: Thu Jul 05, 2018 9:30 am
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
Hi Mark,
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
You can set the start point of ruler annotation (line-based annotation) using the LineAnnotationData.StartPoint property:I want to draw on a AnnotationViewer a
RulerAnnotation from PointF(0,0) to PointF(500,0) programmatically.
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
-
- Posts: 6
- Joined: Thu Jul 05, 2018 9:30 am
Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
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
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
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
Here is code snippet that shows how to add the ruler annotation with coordinates (0;0)-(0;500) to the image in annotation viewer:
Best regards, Alexander
Code: Select all
// 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);
-
- Posts: 6
- Joined: Thu Jul 05, 2018 9:30 am
Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
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
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
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
You need to set the correct image index when you selecting the annotation collection:
Best regards, Alexander
Code: Select all
...
// add the ruler annotation to the image in annotation viewer
int imageIndex = 0;
annotationViewer1.AnnotationDataController[imageIndex].Add(rulerAnnotationData);
-
- Posts: 6
- Joined: Thu Jul 05, 2018 9:30 am
Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
Hi Alex,
I still don't know how to select the Current Page.
Please give me an example. Thank you
Mark
I still don't know how to select the Current Page.
Please give me an example. Thank you
Mark
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: Draw RulerAnnotation from PointF(0,0) to PointF(500, 0)
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
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