Mega Code Archive

 
Categories / Delphi / Graphic
 

How to create your own TPen Style

Title: How to create your own TPen Style First: define your penstyle by creating a array of DWord. This array can be as long as you want to. Just remember to have an even count of objects of DWord in the array. Mine this on a printer with 600 dpi: } kleefPenStyle: array[1..2] of DWORD=(10,10); {I only had to define the first length of the dot and the first white space,but add more DWord objects as you like.} { Secondly: define the look of you Pen, by setting the brush.I have created a variable: } logBrush:TLogBrush. //Set thebrush in your code: logBrush.lbStyle:=BS_SOLID; logBrush.lbColor:=Canvas.Pen.Color; { Finally: make your penstyle known to the Pen: } Canvas.Pen.Handle:=ExtCreatePen(PS_GEOMETRIC or PS_USERSTYLE, Canvas.Pen.Width, logBrush, Length(kleefPenStyle),@kleefPenStyle); {By giving PS_USERSTYLE with the dwPenStyle parameter you let Windows know you've created you own penstyle. The rest of the parameters must be clear to you. Benjamin}