THPDFPage.Rectangle

THPDFPage

 

Đầu trang  Trước  Tiếp

Vẽ một hình chữ nhật

 

Cú pháp Delphi:

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

 

Cú pháp C++:

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

 

Mô tả

Dùng Rectangle để vẽ hình chữ nhật. Chỉ định tọa độ và kích thước của hình chữ nhật. Tọa độ xác định góc trên bên trái tại điểm (X, Y) còn width và height là chiều rộng và chiều cao

To fill a rectangular region use Fill. To outline a rectangular region without filling it, use Stroke. To draw a rectangle with rounded corners, use RoundRect.

 

Ví dụ mã

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.