THPDFPage.Rectangle

THPDFPage

 

顶部  上一页  下一页

Draws a rectangle.

 

Delphi 语法:

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

 

C++ 语法:

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

 

说明

使用 Rectangle 绘制矩形。请指定矩形坐标和尺寸。Coordinates 定义点 (X, Y) 处的左上角,以及宽度和高度

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.

 

代码示例

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.