THPDFPage.Rectangle

THPDFPage

 

Top  Previous  Next

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 );

 

Description

Rectangle로 사각형을 그립니다. 사각형의 좌표와 크기를 지정합니다. 좌표는 점 ( X, Y)에 있는 좌상단 모서리와 폭, 높이를 정의합니다

사각형 영역을 채우려면 Fill을 사용합니다. 채우지 않고 윤곽만 그리려면 Stroke를 사용합니다. 모서리가 둥근 사각형을 그리려면 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.