A color object that defines the required border color of the newly added freehand polygon annotation.
A color object that defines the required background color of the newly added freehand polygon annotation.
An array of points, in inches, which determines the polygon vertices.
Example





In This Topic
GdPicture14 Namespace / AnnotationManager Class / AddFreeHandPolygonAnnot Method

AddFreeHandPolygonAnnot Method (AnnotationManager)

In This Topic
Adds a new GdPicture/XMP freehand polygon annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. A freehand polygon is an arbitrary closed shape filled and bordered with the specified colors.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeFreeHandPolygon. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationFreeHandPolygon class right after the successful creation of the annotation object.

Be aware that annotations are always treated relative to the currently selected page.

Adds a new GdPicture/XMP freehand polygon annotation on the selected page of the document currently handled by this AnnotationManager object.
Syntax

Parameters

BorderColor
A color object that defines the required border color of the newly added freehand polygon annotation.
BackColor
A color object that defines the required background color of the newly added freehand polygon annotation.
Points
An array of points, in inches, which determines the polygon vertices.

Return Value

A GdPicture/XMP AnnotationFreeHandPolygon object. The newly added GdPicture/XMP freehand polygon annotation.
Remarks
Please ensure that you have selected the proper page before starting any annotation related action with the handled document. Annotations are always treated relative to the currently selected page.

You can regularly apply the AnnotationManager.GetStat method to determine if this method has been successful.

Example
How to add a freehand polygon annotation to a newly created image.
Dim status As GdPictureStatus = GdPictureStatus.OK
Using image As GdPictureImaging = New GdPictureImaging()
    Dim imageID As Integer = image.CreateNewGdPictureImage(1000, 1600, CShort(32), Color.White)
    status = image.GetStat()
    If (status = GdPictureStatus.OK) AndAlso (imageID <> 0) Then
        Using annotMgr As AnnotationManager = New AnnotationManager()
            If (annotMgr.InitFromGdPictureImage(imageID) = GdPictureStatus.OK) AndAlso (annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
                Dim px As Single = 5, py As Single = 1, dx As Single = 2, dy As Single = 2
                Dim points1 As PointF() = New PointF(4) { New PointF(px, py), New PointF(px + dx, py), New PointF(px + dx / 2, py + dy / 2),
                                                          New PointF(px + 3 * dx / 2, py + dy), New PointF(px - dx, py + dy) }
                Dim annot As GdPicture14.Annotations.AnnotationPolygon = annotMgr.AddFreeHandPolygonAnnot(Color.LightBlue, Color.SteelBlue, points1)
                If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
                    annot.Author = "GdPicture"
                    annot.BorderWidth = 0.2F
                    annot.Opacity = 0.8F
                End If
                annot.Dispose()
                If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
                    annotMgr.SaveDocumentToJPEG("freehandpolygon.jpeg", 75)
                End If
            End If
            status = annotMgr.GetStat()
            annotMgr.Close()
        End Using
        image.ReleaseGdPictureImage(imageID)
    End If
End Using
'We assume that the GdViewer1 control has been integrated into your application.
If status = GdPictureStatus.OK Then
    GdViewer1.DisplayFromFile("freehandpolygon.jpeg")
Else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddFreeHandPolygonAnnot")
End If
GdPictureStatus status = GdPictureStatus.OK;
using (GdPictureImaging image = new GdPictureImaging())
{
    int imageID = image.CreateNewGdPictureImage(1000, 1600, 32, Color.White);
    status = image.GetStat();
    if ((status == GdPictureStatus.OK) && (imageID != 0))
    {
        using (AnnotationManager annotMgr = new AnnotationManager())
        {
            if ((annotMgr.InitFromGdPictureImage(imageID) == GdPictureStatus.OK) &&
                (annotMgr.SelectPage(1) == GdPictureStatus.OK))
            {
                float px = 5, py = 1, dx = 2, dy = 2;
                PointF[] points1 = new PointF[5] { new PointF(px, py), new PointF(px+dx, py), new PointF(px+dx/2, py+dy/2),
                                                   new PointF(px+3*dx/2, py+dy), new PointF(px-dx, py+dy) };
                GdPicture14.Annotations.AnnotationPolygon annot = annotMgr.AddFreeHandPolygonAnnot(Color.LightBlue, Color.SteelBlue, points1);
                if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
                {
                    annot.Author = "GdPicture";
                    annot.BorderWidth = 0.2f;
                    annot.Opacity = 0.8f;
                }
                annot.Dispose();
                if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
                    annotMgr.SaveDocumentToJPEG("freehandpolygon.jpeg", 75);
            }
            status = annotMgr.GetStat();
            annotMgr.Close();
        }
        image.ReleaseGdPictureImage(imageID);
    }
}
//We assume that the GdViewer1 control has been integrated into your application.
if (status == GdPictureStatus.OK)
    GdViewer1.DisplayFromFile("freehandpolygon.jpeg");
else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddFreeHandPolygonAnnot");
See Also