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");