The horizontal (X) coordinate of the rectangle's starting point, 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 rectangle's starting point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
The width of the rectangle, expressed in the current units specified by the SetMeasurementUnit method.
The height of the rectangle, expressed in the current units specified by the SetMeasurementUnit method.
The radius of the circle, of which the arc in the rectangle's corners is a part, expressed in the current units specified by the SetMeasurementUnit method. The center of this circle is situated inside the rectangle's corners.
Set this parameter to true, if you want to fill the rectangle 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 rectangle (draw a boundary line along the rectangle) 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
GdPicture14 Namespace / GdPicturePDF Class / DrawRoundedRectangle Method

DrawRoundedRectangle Method (GdPicturePDF)

In This Topic
Draws a rounded rectangle (a rectangle with rounded corners) on the currently selected page of the loaded PDF document according to what you have specified. The starting point (the upper left corner) of the rectangle and its dimensions 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 rectangle is clearly defined by the starting point and its width and height.

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 DrawRoundedRectangle( _
   ByVal Left As Single, _
   ByVal Top As Single, _
   ByVal Width As Single, _
   ByVal Height As Single, _
   ByVal Radius As Single, _
   ByVal Fill As Boolean, _
   ByVal Stroke As Boolean _
) As GdPictureStatus
public GdPictureStatus DrawRoundedRectangle( 
   float Left,
   float Top,
   float Width,
   float Height,
   float Radius,
   bool Fill,
   bool Stroke
)
public function DrawRoundedRectangle( 
    Left: Single;
    Top: Single;
    Width: Single;
    Height: Single;
    Radius: Single;
    Fill: Boolean;
    Stroke: Boolean
): GdPictureStatus; 
public function DrawRoundedRectangle( 
   Left : float,
   Top : float,
   Width : float,
   Height : float,
   Radius : float,
   Fill : boolean,
   Stroke : boolean
) : GdPictureStatus;
public: GdPictureStatus DrawRoundedRectangle( 
   float Left,
   float Top,
   float Width,
   float Height,
   float Radius,
   bool Fill,
   bool Stroke
) 
public:
GdPictureStatus DrawRoundedRectangle( 
   float Left,
   float Top,
   float Width,
   float Height,
   float Radius,
   bool Fill,
   bool Stroke
) 

Parameters

Left
The horizontal (X) coordinate of the rectangle's starting point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
Top
The vertical (Y) coordinate of the rectangle's starting point, expressed in the current units specified by the SetMeasurementUnit method with respect to the defined origin, related to the currently selected page.
Width
The width of the rectangle, expressed in the current units specified by the SetMeasurementUnit method.
Height
The height of the rectangle, expressed in the current units specified by the SetMeasurementUnit method.
Radius
The radius of the circle, of which the arc in the rectangle's corners is a part, expressed in the current units specified by the SetMeasurementUnit method. The center of this circle is situated inside the rectangle's corners.
Fill
Set this parameter to true, if you want to fill the rectangle 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 rectangle (draw a boundary line along the rectangle) 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.

Just to remind you that the centers of the four equal circles at the four rectangle's corners are situated inside the rectangle with respect to the Radius parameter.

Example
How to draw rounded rectangles. The example compares a typical rectangle with the rounded one.
Dim caption As String = "Example: DrawRoundedRectangle"
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 rectangles
       (gdpicturePDF.SetLineWidth(0.1F) = GdPictureStatus.OK) AndAlso 'the line width used to stroke
       (gdpicturePDF.DrawRectangle(3, 3, 16, 24, False, True) = GdPictureStatus.OK) AndAlso 'the typical rectangle
       (gdpicturePDF.DrawRoundedRectangle(3, 3, 16, 24, 5, False, True) = GdPictureStatus.OK) AndAlso 'the rounded rectangle
       (gdpicturePDF.DrawRoundedRectangle(3, 3, 16, 24, 3, False, True) = GdPictureStatus.OK) AndAlso 'the rounded rectangle
       (gdpicturePDF.DrawRoundedRectangle(3, 3, 16, 24, 1, False, True) = GdPictureStatus.OK) Then 'the rounded rectangle
        status = gdpicturePDF.SaveToFile("test_DrawRoundedRectangle.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: DrawRoundedRectangle";
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 rectangles
        (gdpicturePDF.SetLineWidth(0.1f) == GdPictureStatus.OK) && //the line width used to stroke
        (gdpicturePDF.DrawRectangle(3, 3, 16, 24, false, true) == GdPictureStatus.OK) && //the typical rectangle
        (gdpicturePDF.DrawRoundedRectangle(3, 3, 16, 24, 5, false, true) == GdPictureStatus.OK) && //the rounded rectangle
        (gdpicturePDF.DrawRoundedRectangle(3, 3, 16, 24, 3, false, true) == GdPictureStatus.OK) && //the rounded rectangle
        (gdpicturePDF.DrawRoundedRectangle(3, 3, 16, 24, 1, false, true) == GdPictureStatus.OK))  //the rounded rectangle
    {
        status = gdpicturePDF.SaveToFile("test_DrawRoundedRectangle.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