[C# 2010] - Create AnnotationRectangleHighlighter.

Discussions about annotation support.
Post Reply
Dr3w
Posts: 22
Joined: Fri Nov 09, 2012 6:22 pm

[C# 2010] - Create AnnotationRectangleHighlighter.

Post by Dr3w » Fri Nov 23, 2012 8:15 pm

Hi at all,
"simple mode" question: how can I draw in my viewer a NEW AnnotationRectangleHighlighter?
I've 2 viewer (on different processes). Once an user draw manually an AnnotationRectangleHighlighter, it must be copy to the second.
I'm getting obj props correctly...

Code: Select all

GdViewer1.AnnotationAddedByUser+=new GdViewer.AnnotationAddedByUserEventHandler(this.GetMeRect);

Code: Select all

private void GetMeRect(int id) 
{
    GdPicture9.AnnotationRectangleHighlighter _r;

    if(GdViewer1.GetAnnotationFromIdx(id).GetAnnotationType().Equals(typeof(AnnotationRectangleHighlighter)))
        _r = (AnnotationRectangleHighlighter)GdViewer1.GetAnnotationFromIdx(id);                        
    
    ///here my WCF client instance call a WCF server method
}
...but I don't know how re-draw it on the second viewer once I received it.
Thank you.

Andrea.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [C# 2010] - Create AnnotationRectangleHighlighter.

Post by Loïc » Fri Nov 23, 2012 9:51 pm

Hello Andrea,

Here a solution:


vb.net

Code: Select all

Private Sub GdViewer1_AnnotationAddedByUser(AnnotationIdx As Integer) Handles GdViewer1.AnnotationAddedByUser
        Dim annot As Annotation = GdViewer1.GetAnnotationFromIdx(AnnotationIdx)
        If TypeOf annot Is AnnotationRectangleHighlighter Then
            Dim highligter As AnnotationRectangleHighlighter = DirectCast(annot, AnnotationRectangleHighlighter)
            GdViewer2.GetAnnotationManager.AddRectangleHighlighterAnnot(highligter.FillColor, highligter.Left - highligter.Width / 2, highligter.Top - highligter.Height / 2, highligter.Width, highligter.Height)
        End If
    End Sub
c#

Code: Select all

 private void GdViewer1_AnnotationAddedByUser(int AnnotationIdx)
        {
            Annotation annot = GdViewer1.GetAnnotationFromIdx(AnnotationIdx);
            if (annot is AnnotationRectangleHighlighter)
            {
                AnnotationRectangleHighlighter highligter = (AnnotationRectangleHighlighter)annot;
                GdViewer2.GetAnnotationManager().AddRectangleHighlighterAnnot(highligter.FillColor, highligter.Left - highligter.Width / 2, highligter.Top - highligter.Height / 2, highligter.Width, highligter.Height);
            }
        }
Hope this helps!

Kind regards,

Loïc

Dr3w
Posts: 22
Joined: Fri Nov 09, 2012 6:22 pm

Re: [C# 2010] - Create AnnotationRectangleHighlighter.

Post by Dr3w » Mon Nov 26, 2012 10:14 am

Thank you Loïc,
it works greatly!

Andrea.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: [C# 2010] - Create AnnotationRectangleHighlighter.

Post by Loïc » Mon Nov 26, 2012 10:42 am

Thank you for the return Andrea :)

Bye,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests