Page 1 of 1

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

Posted: Thu Jul 05, 2018 9:47 am
by markdhem
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

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

Posted: Fri Jul 06, 2018 9:26 am
by Alex
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

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

Posted: Fri Jul 06, 2018 9:35 am
by markdhem
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

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

Posted: Fri Jul 06, 2018 10:44 am
by Alex
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