|
設定虛線樣式類型。
Delphi 語法:
procedure SetDash ( DashArray: array of Byte; Phase: Byte );
C++ 語法:
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、… |
程式碼範例
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
|