THPDFPage.SetDash

THPDFPage

 

トップへ  前へ  次へ

ダッシュパターン(点線/破線のパターン)の種類を設定します。

 

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

Dash pattern example

ダッシュなし

3 units on, 3 units off ... 

1 on, 2 off, 2 on, 2 off, … 

2 on, 1 off, 2 on, 1 off, … 

2 off, 3 on, 5 off, 3 on, 5 off, … 

1 on, 3 off, 2 on, 3 off, 2 on, …        

 

コード例

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.File名前 := '.\Ellipse.pdf';              // Set PDF filename
        HPDF.BeginDoc;                                 // Create PDF file

        HPDF.CurrentPage.SetDash( DashArray, 0 );      // Set  - . -  dash pattern
        HPDF.CurrentPage.MoveTo ( 20, 20 );            // Move 現在の点 to 20, 20
        HPDF.CurrentPage.LineTo ( 300, 100 );          // Draw line from 現在の点 to 200, 100
        HPDF.CurrentPage.Stroke;                       // and stroke

        HPDF.CurrentPage.NoDash;                       // Set solid dash pattern
        HPDF.CurrentPage.MoveTo ( 300, 100 );          // Move 現在の点 to 300, 100
        HPDF.CurrentPage.LineTo ( 10, 200 );           // Draw line from 現在の点 to 10, 100
        HPDF.CurrentPage.Stroke;                       // and stroke

        HPDF.EndDoc;                                   // Close PDF file
    finally
        HPDF.Free;
    end;
end.

 

See also: NoDash