THPDFPage.Rectangle

THPDFPage

 

Topo  Anterior  Próxima

Desenha um retângulo.

 

Sintaxe Delphi:

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

 

Sintaxe C++:

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

 

Descrição

Use Rectangle para desenhar um retângulo. Especifique as coordenadas e o tamanho do retângulo. Coordinates define o canto superior esquerdo no ponto ( X, Y) e a largura e a altura.

Para preencher uma região retangular use Fill. Para contornar uma região retangular sem preenchê-la, use Stroke. Para desenhar um retângulo com cantos arredondados, use RoundRect.

 

Exemplo de código

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.