Components for Developers
© 2000-2008, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
Graphics
Collapse All

This method provides pattern control of dashes and gaps.

Examples of line dash patterns:

Dash string

Appearance

Description

"[] 0"

No dash, solid line.

"[3] 0"

3 units on, 3 off, ...

"[2] 1"

1 on, 2 off, 2 on, 2 off, ...

"[2 1] 0"

2 on, 1 off, 2 on, 1 off, ...

"[3 5] 6"

2 off, 3 on, 5 off, 3 on, 5 off, ...

"[2 3] 11"

1 on, 3 off, 2 on, 3 off, 2 on, ...

Syntax

HRESULT SetLineDash (
BSTR dashString
)
Parameters
dashString
String containing the line dash pattern

Return value
If successful, this method returns S_OK. If it fails, this method should return one of the error values.

Remarks

The line dash pattern controls the pattern of dashes and gaps used to stroke paths. Before beginning to stroke a path, the dash array is cycled through, adding up the lengths of dashes and gaps. When the accumulated length equals the value specified by the dash phase, stroking of the path begins, using the dash array in a cycle from that point forward.

To reset the dash pattern use:

SetLineDash("[] 0");

Example

Drawing Lines

Delphi
[copy to clipboard]
{ PDF object is supposed to be created }
PDF.SetLineWidth(2);
PDF.SetLineDash('[8 5 11 3] 7');
PDF.MoveTo(10, 10);
PDF.DrawLineTo(110, 10);
PDF.Stroke;
PDF.SetLineDash('[] 0');
PDF.MoveTo(10, 15);
PDF.DrawLineTo(110, 15);
PDF.Stroke;
PDF.SaveToFile('test.pdf', true);
C/C++
[copy to clipboard]
// PDF object is supposed to be created
PDF->SetLineWidth(2);
PDF->SetLineDash("[8 5 11 3] 7");
PDF->MoveTo(10, 10);
PDF->DrawLineTo(110, 10);
PDF->Stroke();
PDF->SetLineDash("[] 0");
PDF->MoveTo(10, 15);
PDF->DrawLineTo(110, 15);
PDF->Stroke();
PDF->SaveToFile("test.pdf", true);
C#
[copy to clipboard]
// PDF object is supposed to be created
PDF.SetLineWidth(2);
PDF.SetLineDash("[8 5 11 3] 7");
PDF.MoveTo(10, 10);
PDF.DrawLineTo(110, 10);
PDF.Stroke();
PDF.SetLineDash("[] 0");
PDF.MoveTo(10, 15);
PDF.DrawLineTo(110, 15);
PDF.Stroke();
PDF.SaveToFile("test.pdf", true);
Visual Basic
[copy to clipboard]
' PDF object is supposed to be created
PDF.SetLineWidth 2
PDF.SetLineDash "[8 5 11 3] 7"
PDF.MoveTo 10, 10
PDF.DrawLineTo 110, 10
PDF.Stroke
PDF.SetLineDash "[] 0"
PDF.MoveTo 10, 15
PDF.DrawLineTo 110, 15
PDF.Stroke
PDF.SaveToFile "test.pdf", true

See Also

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF Add-on History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2008, Two Pilots