|
ตั้งค่าชนิดของรูปแบบเส้นประ
Delphi syntax:
procedure SetDash ( DashArray: array of Byte; Phase: Byte );
C++ syntax:
void __fastcall SetDash ( const Byte * DashArray, const int DashArray_Size, Byte Phase);
คำอธิบาย:
รูปแบบเส้นประจะควบคุมรูปแบบของเส้นประและช่องว่างที่ใช้ลากเส้นตามเส้นทาง โดยระบุโดยอาร์เรย์เส้นประและเฟสเส้นประ สมาชิกของอาร์เรย์เส้นประเป็นตัวเลขที่ระบุความยาวของเส้นประและช่องว่างสลับกัน เฟสเส้นประจะระบุระยะทางในรูปแบบเส้นประเพื่อเริ่มต้นเส้นประ
ตัวอย่างของรูปแบบเส้นประ
| อาร์เรย์เส้นประ |
เฟสเส้นประ |
ลักษณะปรากฏ |
คำอธิบาย |
| [] [ 3 ] [ 2 ] [ 2 1 ] [ 3 5 ] [ 2 3 ] |
0 0 1 0 6 11 |
 |
ไม่มีเส้นประ เปิด 3 หน่วย, ปิด 3 หน่วย … เปิด 1, ปิด 2, เปิด 2, ปิด 2, … เปิด 2, ปิด 1, เปิด 2, ปิด 1, … ปิด 2, เปิด 3, ปิด 5, เปิด 3, ปิด 5, … เปิด 1, ปิด 3, เปิด 2, ปิด 3, เปิด 2, … |
Code Example
program FillExample;
{$APPTYPE CONSOLE}
uses
SysUtils, Graphics, Classes, HPDFDoc;
var
HPDF: THotPDF;
const
DashArray: array [0..3] of Byte = ( 6, 4, 2, 4 );
begin
HPDF := THotPDF.Create(nil);
try
HPDF.AutoLaunch := true; // PDF file will be shown automatically
HPDF.FileName := '.\Ellipse.pdf'; // Set PDF filename
HPDF.BeginDoc; // Create PDF file
HPDF.CurrentPage.SetDash( DashArray, 0 ); // Set - . - dash pattern
HPDF.CurrentPage.MoveTo ( 20, 20 ); // Move current point to 20, 20
HPDF.CurrentPage.LineTo ( 300, 100 ); // Draw line from current point to 200, 100
HPDF.CurrentPage.Stroke; // and stroke
HPDF.CurrentPage.NoDash; // Set solid dash pattern
HPDF.CurrentPage.MoveTo ( 300, 100 ); // Move current point to 300, 100
HPDF.CurrentPage.LineTo ( 10, 200 ); // Draw line from current point to 10, 100
HPDF.CurrentPage.Stroke; // and stroke
HPDF.EndDoc; // Close PDF file
finally
HPDF.Free;
end;
end.
ดูเพิ่มเติม: NoDash
|