Page 1 of 1

CustomAnnotation - don't want to select annot. after draw

Posted: Tue Jan 31, 2012 8:37 am
by Junhui
I've made custom annotation class which overrides LinesAnnotation.
After drawing that annotation(customed) on annotationviewer, it selected automatically.
I want to select custom annotation manually, but not select automatically after drawing.
Can I do that with OnFinishBuilding(System.Drawing.PointF point)? Or anotherway?

class MyLineAnnotation : LinesAnnotation
{
protected override void OnBuilding(MouseEventArgs e, MouseActions action)
{
... ...
}

protected override void OnFinishBuilding(System.Drawing.PointF point)
{
base.OnFinishBuilding(point);
// how can I reach the goal...
}
}

Best Regards,
Jun Hee.

Re: CustomAnnotation - don't want to select annot. after dra

Posted: Tue Jan 31, 2012 11:04 am
by Alex
Hello Jun,

You can set the selected annotation in the annotation viewer using the SelectedAnnotation property of the AnnotationViewer.

Best regards, Alexander

Re: CustomAnnotation - don't want to select annot. after dra

Posted: Mon Feb 06, 2012 10:30 am
by Junhui
I handled this issue with codes below,

[DllImport("user32.dll")]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtaInfo);

and I generated 'mouse_event(0x8 | 0x10, 0, 0, 0, 0);' after draw.

Best regards,
Jun Hee.

Re: CustomAnnotation - don't want to select annot. after dra

Posted: Mon Feb 06, 2012 11:40 am
by Alex
Hello Jun,

It is the possible solution but not the best.

Why have you not used the SelectedAnnotation property?

Best regards, Alexander