Reference Guide
GdPicture14 Namespace / GdPicturePDF Class / DrawCircle Method
The horizontal (X) coordinate of the circle's center, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The vertical (Y) coordinate of the circle's center, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The required radius of the circle, expressed in the current units specified by the SetMeasurementUnit method.
Set this parameter to true, if you want to fill the circle using the currently defined fill color, otherwise set it to false. You can set the fill color using the SetFillColor(Byte,Byte,Byte) method.
Set this parameter to true, if you want to stroke the circle (draw a boundary line along the circle) using the currently defined line color, otherwise set it to false. You can set the line color using the SetLineColor(Byte,Byte,Byte) method.
Example





In This Topic
    DrawCircle Method (GdPicturePDF)
    In This Topic
    Draws a circle on the currently selected page of the loaded PDF document according to what you have specified. The center of the circle and its radius need to be set in the current units defined in the PDF document with respect to the currently located origin, related to the actual page. The circle is clearly defined by the center and its radius.

    You can simply use the GetMeasurementUnit method to determine the currently defined units and you can easily use the SetMeasurementUnit method to reset the units according to your preference.

    Syntax
    'Declaration
     
    
    Public Function DrawCircle( _
       ByVal CenterX As Single, _
       ByVal CenterY As Single, _
       ByVal Radius As Single, _
       ByVal Fill As Boolean, _
       ByVal Stroke As Boolean _
    ) As GdPictureStatus
    public GdPictureStatus DrawCircle( 
       float CenterX,
       float CenterY,
       float Radius,
       bool Fill,
       bool Stroke
    )
    public function DrawCircle( 
        CenterX: Single;
        CenterY: Single;
        Radius: Single;
        Fill: Boolean;
        Stroke: Boolean
    ): GdPictureStatus; 
    public function DrawCircle( 
       CenterX : float,
       CenterY : float,
       Radius : float,
       Fill : boolean,
       Stroke : boolean
    ) : GdPictureStatus;
    public: GdPictureStatus DrawCircle( 
       float CenterX,
       float CenterY,
       float Radius,
       bool Fill,
       bool Stroke
    ) 
    public:
    GdPictureStatus DrawCircle( 
       float CenterX,
       float CenterY,
       float Radius,
       bool Fill,
       bool Stroke
    ) 

    Parameters

    CenterX
    The horizontal (X) coordinate of the circle's center, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
    CenterY
    The vertical (Y) coordinate of the circle's center, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
    Radius
    The required radius of the circle, expressed in the current units specified by the SetMeasurementUnit method.
    Fill
    Set this parameter to true, if you want to fill the circle using the currently defined fill color, otherwise set it to false. You can set the fill color using the SetFillColor(Byte,Byte,Byte) method.
    Stroke
    Set this parameter to true, if you want to stroke the circle (draw a boundary line along the circle) using the currently defined line color, otherwise set it to false. You can set the line color using the SetLineColor(Byte,Byte,Byte) method.

    Return Value

    A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

    We strongly recommend always checking this status first.

    Remarks
    Please note that this method is only allowed for use with non-encrypted documents.
    Example
    How to draw stroked and filled circles. The example shows you reasonable combinations of the Fill and the Stroke parameters.
    Dim caption As String = "Example: DrawCircle"
    Dim oGdPicturePDF As New GdPicturePDF()
    Dim status As GdPictureStatus = oGdPicturePDF.NewPDF()
    If status = GdPictureStatus.OK Then
        oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
        oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
        If (oGdPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetLineColor(255, 140, 0) = GdPictureStatus.OK) AndAlso 'the color used to stroke the circles
           (oGdPicturePDF.SetLineWidth(0.2F) = GdPictureStatus.OK) AndAlso 'the line width used to stroke
           (oGdPicturePDF.SetFillColor(153, 50, 204) = GdPictureStatus.OK) AndAlso 'the color used to fill the circles
           (oGdPicturePDF.DrawCircle(10, 15, 8, False, True) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawCircle(10, 15, 6, True, True) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.SetFillColor(255, 255, 0) = GdPictureStatus.OK) AndAlso
           (oGdPicturePDF.DrawCircle(10, 15, 4, True, False) = GdPictureStatus.OK) Then
            status = oGdPicturePDF.SaveToFile("test_DrawCircle.pdf")
            If status = GdPictureStatus.OK Then
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
            Else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption)
            End If
        Else
            MessageBox.Show("The example has not been followed successfully." + vbCrLf + "The last known status is " + oGdPicturePDF.GetStat().ToString(), caption)
        End If
    Else
        MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
    End If
    oGdPicturePDF.Dispose()
    string caption = "Example: DrawCircle";
    GdPicturePDF oGdPicturePDF = new GdPicturePDF();
    GdPictureStatus status = oGdPicturePDF.NewPDF();
    if (status == GdPictureStatus.OK)
    {
        oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
        oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
        if ((oGdPicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetLineColor(255, 140, 0) == GdPictureStatus.OK) && //the color used to stroke the circles
            (oGdPicturePDF.SetLineWidth(0.2f) == GdPictureStatus.OK) && //the line width used to stroke
            (oGdPicturePDF.SetFillColor(153, 50, 204) == GdPictureStatus.OK) && //the color used to fill the circles
            (oGdPicturePDF.DrawCircle(10, 15, 8, false, true) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawCircle(10, 15, 6, true, true) == GdPictureStatus.OK) &&
            (oGdPicturePDF.SetFillColor(255, 255, 0) == GdPictureStatus.OK) &&
            (oGdPicturePDF.DrawCircle(10, 15, 4, true, false) == GdPictureStatus.OK))
        {
            status = oGdPicturePDF.SaveToFile("test_DrawCircle.pdf");
            if (status == GdPictureStatus.OK)
                MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
            else
                MessageBox.Show("The example has been followed successfully, but the file can't be saved. Status: " + status.ToString(), caption);
        }
        else
            MessageBox.Show("The example has not been followed successfully.\nThe last known status is " + oGdPicturePDF.GetStat().ToString(), caption);
    }
    else
        MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
    oGdPicturePDF.Dispose();
    See Also