Howto set the postion of Textannotation.Textbox

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

Moderator: Alex

Post Reply
MichaelHerrmanns
Posts: 17
Joined: Mon Jan 03, 2011 2:45 pm

Howto set the postion of Textannotation.Textbox

Post by MichaelHerrmanns » Fri Feb 17, 2012 10:44 am

Hello,

I have a question of howto positioning the textbox of an textannotation.
When I use the location propety of the textannotation, then sometimes depending on the resolution of the picture
the textbox appears on the right place. In other times the textbox appears somewhere.

The reason of my question is, that I want to open the textbox even when the textannotation is buildet.
viewtopic.php?f=16&t=1722
In other situations (the user edit the text) the textbox everytime appears on the right place.

Best regards

Michael

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

Re: Howto set the postion of Textannotation.Textbox

Post by Alex » Fri Feb 17, 2012 4:04 pm

Hello Michael,

You can use the PointToControl method of the ImageViewer class and determine coordinates of left-top corner of annotation in the viewer space:

Code: Select all

Point leftTop = new Point((int)(textAnno.Location.X - textAnno.Size.Width / 2), (int)(textAnno.Location.Y - textAnno.Size.Height / 2));
textBox.Location = viewer.PointToControl(leftTop);
Best regards, Alexander

MichaelHerrmanns
Posts: 17
Joined: Mon Jan 03, 2011 2:45 pm

Re: Howto set the postion of Textannotation.Textbox

Post by MichaelHerrmanns » Mon Feb 20, 2012 11:50 am

Hello Alex,

it works perfectly.
Thank you very much.

best regards

Michael

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests