Winforms - Show distance value of the ruler annotation to a text field.

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

Moderator: Alex

Post Reply
markdhem
Posts: 6
Joined: Thu Jul 05, 2018 9:30 am

Winforms - Show distance value of the ruler annotation to a text field.

Post by markdhem » Thu Jul 05, 2018 9:47 am

Hi there,

How can I fetch the distance of the ruler annotation to a text field in C# just like the image below.
Image
Thank you in advance. :)


Best Regards,
Mark
Last edited by markdhem on Fri Jul 06, 2018 10:14 am, edited 1 time in total.

Alex
Site Admin
Posts: 1587
Joined: Thu Jul 10, 2008 2:21 pm

Re: Winforms - Show distance value of the ruler annotation to a text field.

Post by Alex » Fri Jul 06, 2018 9:26 am

Hi Mark,
How can I fetch the distance of the ruler annotation to a text field in C# just like the image below.
URL to your image is broken, please add new image.

You can get the length of ruler using the RulerAnnotationData.Length property:
https://www.vintasoft.com/docs/vsimagin ... ength.html

You can get the unit of measure of ruler using the RulerAnnotationData.UnitOfMeasure property:
https://www.vintasoft.com/docs/vsimagin ... asure.html

Best regards, Alexander

markdhem
Posts: 6
Joined: Thu Jul 05, 2018 9:30 am

Re: Winforms - Show distance value of the ruler annotation to a text field.

Post by markdhem » Fri Jul 06, 2018 9:35 am

Hi Alex,



Thanks for your reply,
Here is my screenshot, https://drive.google.com/open?id=18Qsda ... qt5M1SU6Li.

I actually got it at

Code: Select all

annotationViewer1_AnnotationTransformingFinished
now but it will only appears the pixels value. What I want is the millimeters.
Here is my code.

Code: Select all

foreach (AnnotationView view in annotationViewer1.SelectedAnnotations)
{
    // end the initialization of annotation view
    EndInit(view.Data);

    var size = view.Data.Size.Width;
    var mmSize = size ; //What is the formula here?
    textBox2.Text = mmSize.ToString();
}
Regards,
Mark

Alex
Site Admin
Posts: 1587
Joined: Thu Jul 10, 2008 2:21 pm

Re: Winforms - Show distance value of the ruler annotation to a text field.

Post by Alex » Fri Jul 06, 2018 10:44 am

now but it will only appears the pixels value. What I want is the millimeters.
You can change the unit of measure using the RulerAnnotationData.UnitOfMeasure property:
https://www.vintasoft.com/docs/vsimagin ... asure.html

Best regards, Alexander

Post Reply