GdPicture.NET.14
GdPicture14 Namespace / AnnotationManager Class / AddConnectedLinesAnnot Method
A color object that defines the required color of the newly added connected lines annotation. It corresponds to the AnnotationConnectedLines.StrokeColor property.
An array of points, in inches, which determines the single line segments to be connected.
Example





In This Topic
AddConnectedLinesAnnot Method (AnnotationManager)
In This Topic
Adds a new GdPicture/XMP connected lines annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. A connected lines annotation depicts a polyline consisting of several straight lines. This method uses the round cap style on both polyline ending points.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeConnectedLines. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationConnectedLines 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 connected lines annotation on the selected page of the document currently handled by this AnnotationManager object.
Syntax
'Declaration
 
Public Function AddConnectedLinesAnnot( _
   ByVal BorderColor As Color, _
   ByVal Points() As PointF _
) As AnnotationConnectedLines
public AnnotationConnectedLines AddConnectedLinesAnnot( 
   Color BorderColor,
   PointF[] Points
)
public function AddConnectedLinesAnnot( 
    BorderColor: Color;
    Points: PointFarray of
): AnnotationConnectedLines; 
public function AddConnectedLinesAnnot( 
   BorderColor : Color,
   Points : PointF[]
) : AnnotationConnectedLines;
public: AnnotationConnectedLines* AddConnectedLinesAnnot( 
   Color BorderColor,
   PointF[]* Points
) 
public:
AnnotationConnectedLines^ AddConnectedLinesAnnot( 
   Color BorderColor,
   array<PointF>^ Points
) 

Parameters

BorderColor
A color object that defines the required color of the newly added connected lines annotation. It corresponds to the AnnotationConnectedLines.StrokeColor property.
Points
An array of points, in inches, which determines the single line segments to be connected.

Return Value

A GdPicture/XMP AnnotationConnectedLines object. The newly added GdPicture/XMP connected lines 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 GetStat method to determine if this method has been successful.

Example
How to add a connected lines annotations 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 = 3, py As Single = 1, dx As Single = 3, dy As Single = 2
                Dim points1 As PointF() = New PointF(3) {New PointF(px, py), New PointF(px + dx / 2, py + dy), New PointF(dx / 2, py + dy), New PointF(px, py)}
                Dim annot As GdPicture14.Annotations.AnnotationConnectedLines = annotMgr.AddConnectedLinesAnnot(Color.LightBlue, points1)
                If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
                    annot.Author = "GdPicture"
                    annot.BorderWidth = 0.2F
                    annot.Opacity = 1
                End If
                annot.Dispose()
                Dim points2 As PointF() = New PointF(3) {New PointF(px + dx / 2 + 1, py), New PointF(px + dx / 2 + 1 + dx, py), New PointF(px + dx + 1, py + dy), New PointF(px + dx / 2 + 1, py)}
                annot = annotMgr.AddConnectedLinesAnnot(Color.LightBlue, points2)
                If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
                    annot.Author = "GdPicture"
                    annot.BorderWidth = 0.2F
                    annot.Opacity = 1
                End If
                annot.Dispose()
                If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
                    annotMgr.SaveDocumentToJPEG("lines.jpeg", 75)
                End If
                status = annotMgr.GetStat()
                annotMgr.Close()
            End If
        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("lines.jpeg")
Else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddConnectedLinesAnnot")
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 = 3, py = 1, dx = 3, dy = 2;
                PointF[] points1 = new PointF[4] { new PointF(px, py), new PointF(px+dx/2, py+dy),
                                                  new PointF(dx/2, py+dy), new PointF(px, py)};
                GdPicture14.Annotations.AnnotationConnectedLines annot = annotMgr.AddConnectedLinesAnnot(Color.LightBlue, points1);
                if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
                {
                    annot.Author = "GdPicture";
                    annot.BorderWidth = 0.2f;
                    annot.Opacity = 1;
                }
                annot.Dispose();
            
                PointF[] points2 = new PointF[4] { new PointF(px + dx / 2 + 1, py), new PointF(px + dx / 2 + 1 + dx, py),
                                                   new PointF(px + dx + 1, py+dy), new PointF(px+dx/2+1, py)};
                annot = annotMgr.AddConnectedLinesAnnot(Color.LightBlue, points2);
                if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
                {
                    annot.Author = "GdPicture";
                    annot.BorderWidth = 0.2f;
                    annot.Opacity = 1;
                }
                annot.Dispose();
                if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
                    annotMgr.SaveDocumentToJPEG("lines.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("lines.jpeg");
else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddConnectedLinesAnnot");
See Also