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.AddPolygonAnnot(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("polygon.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("polygon.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddPolygonAnnot")
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.AddPolygonAnnot(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("polygon.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("polygon.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddPolygonAnnot");