'We assume that the annotationManager object has been integrated into your application.
Friend WithEvents annotationManager As GdPicture14.AnnotationManager
'Add the event.
AddHandler annotationManager.OnCustomAnnotationPaint, AddressOf annotationManager_OnCustomAnnotationPaint
'Define the event.
Sub annotationManager_OnCustomAnnotationPaint(ByVal Annot As GdPicture14.Annotations.AnnotationCustom, ByVal g As System.Drawing.Graphics) Handles annotationManager.OnCustomAnnotationPaint
Select Case Annot.ModelID
Case 1 'triangle annotation
Using gp As New Drawing.Drawing2D.GraphicsPath
gp.AddLine(New PointF(Annot.Left - Annot.Width / 2, Annot.Top + Annot.Height / 2), New PointF(Annot.Left, Annot.Top - Annot.Height / 2))
gp.AddLine(New PointF(Annot.Left, Annot.Top - Annot.Height / 2), New PointF(Annot.Left + Annot.Width / 2, Annot.Top + Annot.Height / 2))
gp.CloseFigure()
g.DrawPath(New Pen(Brushes.Red, 0.1), gp)
End Using
Case 2 'cross annotation
g.DrawLine(New Pen(Brushes.Red, 0.1), New PointF(Annot.Left - Annot.Width / 2, Annot.Top - Annot.Height / 2), New PointF(Annot.Left + Annot.Width / 2, Annot.Top + Annot.Height / 2))
g.DrawLine(New Pen(Brushes.Red, 0.1), New PointF(Annot.Left - Annot.Width / 2, Annot.Top + Annot.Height / 2), New PointF(Annot.Left + Annot.Width / 2, Annot.Top - Annot.Height / 2))
End Select
End Sub
//We assume that the annotationManager object has been integrated into your application.
//Add the event.
annotationManager.OnCustomAnnotationPaint += annotationManager_OnCustomAnnotationPaint;
//Define the event.
void annotationManager_OnCustomAnnotationPaint(GdPicture14.Annotations.AnnotationCustom Annot, System.Drawing.Graphics g)
{
switch (Annot.ModelID)
{
case 1:
using (System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath())
{
gp.AddLine(new PointF(Annot.Left - Annot.Width / 2, Annot.Top + Annot.Height / 2), new PointF(Annot.Left, Annot.Top - Annot.Height / 2));
gp.AddLine(new PointF(Annot.Left, Annot.Top - Annot.Height / 2), new PointF(Annot.Left + Annot.Width / 2, Annot.Top + Annot.Height / 2));
gp.CloseFigure();
g.DrawPath(new Pen(System.Drawing.Brushes.Red, 0.1f), gp);
}
break;
case 2:
g.DrawLine(new Pen(System.Drawing.Brushes.Red, 0.1f), new PointF(Annot.Left - Annot.Width / 2, Annot.Top - Annot.Height / 2), new PointF(Annot.Left + Annot.Width / 2, Annot.Top + Annot.Height / 2));
g.DrawLine(new Pen(System.Drawing.Brushes.Red, 0.1f), new PointF(Annot.Left - Annot.Width / 2, Annot.Top + Annot.Height / 2), new PointF(Annot.Left + Annot.Width / 2, Annot.Top - Annot.Height / 2));
break;
default: break;
}
}