这个:
function CreateMyPen(const Width:integer):HPEN;
var myStyle: DWORD;
myBrush: TLogBrush;
begin
PenStyle := PS_GEOMETRIC or PS_ENDCAP_FLAT or PS_JOIN_ROUND or PS_DOT;
with myBrush do
begin
lbStyle := BS_SOLID;
lbColor := GetColor;
lbHatch := HS_BDIAGONAL;
end;
result := ExtCreatePen(PenStyle, DWORD(3), PenBrush, 0, nil);
end;
////
canvas.pen := CreateMyPen(4)
canvas.MoveTo(10,10);
canvas.LineTo(100,100);