THPDFPage.Rectangle

THPDFPage

InizioPrecedenteSuccessivo

Draws a Rectangle.

Sintassi Delphi:

procedure Rectangle ( X, Y, Width, Height: Single );

Sintassi C++:

void __fastcall Rectangle ( float X, float Y, float Width, float Height );

Descrizione

Usa Rectangle per disegnare un rettangolo. Specifica le coordinate e le dimensioni del rettangolo. Le coordinate definiscono l'angolo in alto a sinistra nel punto ( X, Y ), più larghezza e altezza.

Per riempire una regione rettangolare usa Fill. Per tracciare il contorno di una regione rettangolare senza riempirla, usa Stroke. Per disegnare un rettangolo con gli angoli arrotondati, usa RoundRect.

Example di codice

program HelloWorld;
{$APPTYPE CONSOLE}
uses
    SysUtils, Graphics, Classes, HPDFDoc;

var
    HPDF: THotPDF;

begin
    HPDF := THotPDF.Create(nil);
    try
        HPDF.AutoLaunch := true;                                 // PDF file will be shown automatically
        HPDF.FileName := 'Rectangle.pdf';                   // Set PDF filename
        HPDF.BeginDoc;                                               // Create PDF file
        HPDF.CurrentPage.Rectangle( 10, 10, 100, 100 ); // Draw Rectangle and fill
        HPDF.CurrentPage.ClosePathEoFillAndStroke;
        HPDF.EndDoc;                                                  // Close PDF file
    finally
        HPDF.Free;
    end;
end.