GdPicture.NET.14
GdPicture14 Namespace / AnnotationManager Class / AddEllipseAnnot Method
A color object that defines the required border color of the newly added ellipse annotation.
The horizontal (X) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
The vertical (Y) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
The width of the annotation bounding box, in inches.
The height of the annotation bounding box, in inches.
Example





In This Topic
AddEllipseAnnot Method (AnnotationManager)
In This Topic
Adds a new GdPicture/XMP ellipse annotation on the selected page of the document currently handled by this AnnotationManager object according to the parameters you have specified. This annotation represents a filled and bordered ellipse or circle drawn with the specified colors.

The type of the newly added annotation object is GdPictureAnnotationType.AnnotationTypeEllipse. You can change the annotation properties directly using the GdPicture14.Annotations.AnnotationEllipse 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 ellipse annotation on the selected page of the document currently handled by this AnnotationManager object.
Syntax
'Declaration
 
Public Function AddEllipseAnnot( _
   ByVal BorderColor As Color, _
   ByVal Left As Single, _
   ByVal Top As Single, _
   ByVal Width As Single, _
   ByVal Height As Single _
) As AnnotationEllipse
public AnnotationEllipse AddEllipseAnnot( 
   Color BorderColor,
   float Left,
   float Top,
   float Width,
   float Height
)
public function AddEllipseAnnot( 
    BorderColor: Color;
    Left: Single;
    Top: Single;
    Width: Single;
    Height: Single
): AnnotationEllipse; 
public function AddEllipseAnnot( 
   BorderColor : Color,
   Left : float,
   Top : float,
   Width : float,
   Height : float
) : AnnotationEllipse;
public: AnnotationEllipse* AddEllipseAnnot( 
   Color BorderColor,
   float Left,
   float Top,
   float Width,
   float Height
) 
public:
AnnotationEllipse^ AddEllipseAnnot( 
   Color BorderColor,
   float Left,
   float Top,
   float Width,
   float Height
) 

Parameters

BorderColor
A color object that defines the required border color of the newly added ellipse annotation.
Left
The horizontal (X) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
Top
The vertical (Y) coordinate of the top left point, in inches, where the annotation bounding box is to be located.
Width
The width of the annotation bounding box, in inches.
Height
The height of the annotation bounding box, in inches.

Return Value

A GdPicture/XMP AnnotationEllipse object. The newly added GdPicture/XMP ellipse 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 an ellipse 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 left As Single = 4, top As Single = 2
                Dim annotEllipse As GdPicture14.Annotations.AnnotationEllipse = annotMgr.AddEllipseAnnot(Color.BlueViolet, left, top, left + 2, top + 1)
                If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annotEllipse IsNot Nothing) Then
                    annotEllipse.Author = "GdPicture"
                    annotEllipse.BorderWidth = 0.1F
                    annotEllipse.Opacity = 0.8F
                    annotEllipse.Fill = True
                    annotEllipse.FillColor = Color.MediumVioletRed
                End If
                annotEllipse.Dispose()
                If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
                    annotMgr.SaveDocumentToJPEG("ellipse.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("ellipse.jpeg")
Else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddEllipseAnnot")
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 left = 4, top = 2;
                GdPicture14.Annotations.AnnotationEllipse annotEllipse = annotMgr.AddEllipseAnnot(Color.BlueViolet, left, top, left + 2, top + 1);
                if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annotEllipse != null))
                {
                    annotEllipse.Author = "GdPicture";
                    annotEllipse.BorderWidth = 0.1f;
                    annotEllipse.Opacity = 0.8f;
                    annotEllipse.Fill = true;
                    annotEllipse.FillColor = Color.MediumVioletRed;
                }
                annotEllipse.Dispose();
                if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
                    annotMgr.SaveDocumentToJPEG("ellipse.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("ellipse.jpeg");
else
    MessageBox.Show("Error!   Status: " + status.ToString(), "AnnotationManager.AddEllipseAnnot");
See Also