GdPicture.NET.14.API
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 GdPicturePDF.SetFillColor 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 GdPicturePDF.SetLineColor 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 GdPicturePDF.GetMeasurementUnit method to determine the currently defined units and you can easily use the GdPicturePDF.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 GdPicturePDF.SetFillColor 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 GdPicturePDF.SetLineColor 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
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 gdpicturePDF As New GdPicturePDF()
Dim status As GdPictureStatus = gdpicturePDF.NewPDF()
If status = GdPictureStatus.OK Then
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft)
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter)
    If (gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.SetLineColor(255, 140, 0) = GdPictureStatus.OK) AndAlso 'the color used to stroke the circles
       (gdpicturePDF.SetLineWidth(0.2F) = GdPictureStatus.OK) AndAlso 'the line width used to stroke
       (gdpicturePDF.SetFillColor(153, 50, 204) = GdPictureStatus.OK) AndAlso 'the color used to fill the circles
       (gdpicturePDF.DrawCircle(10, 15, 8, False, True) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.DrawCircle(10, 15, 6, True, True) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.SetFillColor(255, 255, 0) = GdPictureStatus.OK) AndAlso
       (gdpicturePDF.DrawCircle(10, 15, 4, True, False) = GdPictureStatus.OK) Then
        status = gdpicturePDF.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 " + gdpicturePDF.GetStat().ToString(), caption)
    End If
Else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: DrawCircle";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
GdPictureStatus status = gdpicturePDF.NewPDF();
if (status == GdPictureStatus.OK)
{
    gdpicturePDF.SetOrigin(PdfOrigin.PdfOriginTopLeft);
    gdpicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
    if ((gdpicturePDF.NewPage(PdfPageSizes.PdfPageSizeA4) == GdPictureStatus.OK) &&
        (gdpicturePDF.SetLineColor(255, 140, 0) == GdPictureStatus.OK) && //the color used to stroke the circles
        (gdpicturePDF.SetLineWidth(0.2f) == GdPictureStatus.OK) && //the line width used to stroke
        (gdpicturePDF.SetFillColor(153, 50, 204) == GdPictureStatus.OK) && //the color used to fill the circles
        (gdpicturePDF.DrawCircle(10, 15, 8, false, true) == GdPictureStatus.OK) &&
        (gdpicturePDF.DrawCircle(10, 15, 6, true, true) == GdPictureStatus.OK) &&
        (gdpicturePDF.SetFillColor(255, 255, 0) == GdPictureStatus.OK) &&
        (gdpicturePDF.DrawCircle(10, 15, 4, true, false) == GdPictureStatus.OK))
    {
        status = gdpicturePDF.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 " + gdpicturePDF.GetStat().ToString(), caption);
}
else
    MessageBox.Show("The NewPDF() method has failed with the status: " + status.ToString(), caption);
gdpicturePDF.Dispose();
See Also