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.

TextAnnotationData on the Left Bottom Position of an Image



TextAnnotationData on the Left Bottom Position of an Image

Post by GHWels »

Hallo Alex

I want to draw a TextAnnotationData on the Left Bottom Position of an Image.

Gunther


Re: TextAnnotationData on the Left Bottom Position of an Image

Post by Alex »

Hello Gunther,

Do you want to draw annotation using mouse or programmatically?

Please see code samples here: https://www.vintasoft.com/forums/viewforum.php?f=24
and let me know if code samples do not help you.

Best regards, Alexander


Re: TextAnnotationData on the Left Bottom Position of an Image

Post by GHWels »

Hallo Alex!

I have seen the code, but the position is not correct.

Viewer.Size = New Size(Viewer.Images(0).Width, Viewer.Images(0).Height)

Dim Data As New TextAnnotationData()
Data.Text = Datum.ToString("dd.MM.yyyy HH:mm")
.
.
.
Data.Location = New PointF(Data.Size.Width / 2 + 5, Viewer.Height - 5)
Viewer.AddAndBuildAnnotation(Data)

Gunther


Re: TextAnnotationData on the Left Bottom Position of an Image

Post by Alex »

Hello Gunther,

All locations and sizes of annotations are specified in device-independent untis (1/96th inch per unit).

Here is a code snippet that shows how to create text annotation at thw left bottom position of image:
// get reference to the first image
VintasoftImage image = annotationViewer1.Images[0];
// calculate image height in device-independent pixels (1/96th inch per unit)
float imageHeightInDIP = image.Height / image.Resolution.Vertical * 96f;

// create text annotation
TextAnnotationData textAnnoData = new TextAnnotationData();
textAnnoData.Text = "Test!";
textAnnoData.Font.Size = 36;
textAnnoData.Size = new SizeF(300, 200);
textAnnoData.Location = new PointF(textAnnoData.Size.Width / 2, imageHeightInDIP - textAnnoData.Size.Height / 2);
            
// create text annotation view
TextAnnotationView textAnnoView = new TextAnnotationView(textAnnoData);

// get reference to annotation view collection of first image
AnnotationViewCollection annoViews = annotationViewer1.AnnotationViewController[0];
// add text annotation view to annotation view collection of first image
annoViews.Add(textAnnoView);
Best regards, Alexander


Re: TextAnnotationData on the Left Bottom Position of an Image

Post by GHWels »

Thank you, it works.
Gunther


Page 1 from 1: 1