|
الگوی dash را تنظیم میکند
نحو Delphi:
procedure SetDash ( DashArray: array of Byte; Phase: Byte );
نحو C++:
void __fastcall SetDash ( const Byte * DashArray, const int DashArray_Size, Byte Phase);
توضیح:
الگوی dash خط، الگوی خطچینها و فاصلههایی را که برای stroke کردن مسیرها استفاده میشود کنترل میکند. این الگو با یک dash array و یک dash phase مشخص میشود. عناصر dash array عددهایی هستند که طول خطچینها و فاصلههای متناوب را تعیین میکنند؛ dash phase فاصلهای را درون الگوی dash مشخص میکند که خطچین از آنجا شروع شود
نمونههایی از الگوهای dash خط
| آرایه dash |
فاز dash |
ظاهر |
توضیح |
| [] [ 3 ] [ 2 ] [ 2 1 ] [ 3 5 ] [ 2 3 ] |
0 0 1 0 6 11 |
 |
بدون dash 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
|