Page 1 of 1

Textannotation show textbox automaticly

Posted: Tue Jan 24, 2012 11:26 pm
by MichaelHerrmanns
Hello Alexander,

is there a possibility to show the textbox of an textannotion automaticly after the annotation is finished building?
I try same things but without success.

Best regards

Michael

Re: Textannotation show textbox automaticly

Posted: Thu Jan 26, 2012 1:16 pm
by Alex
Hello Michael,

Yes, you can show text box associated with annotation automatically when annotation is finished building.

Here is a snippet of code:

Code: Select all

private void annotationViewer1_AnnotationBuildingFinished(object sender, EventArgs e)
{
    AnnotationBase anno = annotationViewer1.SelectedAnnotation;
    TextAnnotation textAnno = anno as TextAnnotation;
    if (textAnno != null)
    {
        annotationViewer1.Controls.Add(textAnno.TextBox);
    }
}
Best regards, Alexander

Re: Textannotation show textbox automaticly

Posted: Thu Jan 26, 2012 5:01 pm
by MichaelHerrmanns
Hello Alexander,

thank you for you reply.
The code work as I aspected.
I extended it with the location of the textannotation

Code: Select all

textAnno.TextBox.Location = New Point(CInt(textAnno.Location.X), CInt(textAnno.Location.Y))
Otherwise the textbox appear on location (0,0).

Best

Regards

Michael