THPDFPage.Rectangle

THPDFPage

 

Góra  Poprzedni  Następny

Draws a Rectangle.

 

Delphi syntax:

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

 

C++ syntax:

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

 

Opis

Użyj Rectangle, aby narysować prostokąt. Określ współrzędne i rozmiar prostokąta. Coordinates definiuje lewy górny róg w punkcie ( X, Y) oraz szerokość i wysokość

Aby wypełnić obszar prostokątny, użyj Fill. Aby obrysować obszar prostokątny bez wypełniania, użyj Stroke. Aby narysować prostokąt z zaokrąglonymi rogami, użyj RoundRect

 

Code Example

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.