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 »

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: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: Howto set the postion of Textannotation.Textbox

Post by Alex »

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 »

Hello Alex,

it works perfectly.
Thank you very much.

best regards

Michael
Post Reply