Can I resize a line stroke?

I draw a dashed line on the TImage canvas and find out that the dash size is too large for the drawing area. Is there a way to resize the dash lines drawn on canvas?
This is what I do to draw dotted lines.

Canvas.Pen.Style := psDash; Canvas.Polyline(myPoints); 

And I did not find any Pen property that could change the size and length of the dash.

thanks

+4
source share
2 answers

According to http://docwiki.embarcadero.com/VCL/e/index.php/Graphics.TPenStyle you can use psUserStyle

The documents for ExtCreatePen are at http://msdn.microsoft.com/en-us/library/dd162705(VS.85).aspx

Here is my interpretation of how ExtCreatePen is supposed to be used in conjunction with TPen:

 const NumberOfSections = 8; LineLengths: array[0..NumberOfSections-1] of DWORD = (20, 15, 14, 17, 14, 8, 16, 9); var logBrush: TLogBrush; begin logBrush.lbStyle := BS_SOLID; logBrush.lbColor := DIB_RGB_COLORS; logBrush.lbHatch := HS_BDIAGONAL; // ignored Canvas.Pen.Handle := ExtCreatePen(PS_GEOMETRIC or PS_USERSTYLE or PS_ENDCAP_ROUND or PS_JOIN_BEVEL, 4, logBrush, NumberOfSections, @LineLengths[0]); // now Canvas.Pen.Style = psUserStyle Canvas.Polyline([Point(0,0), Point(100,100), Point(200, 100)]); end; 
+6
source

I do not know, but what is the implementation of Polyline ()? When you control + click on it, what code do you see? Could this use a variable subject to properties? If so, you can install it, otherwise - if it is hard-coded - you will see it and know that you cannot.

0
source

All Articles