Is there any way to set the style for the lineends for the TCanvas.LineTo method? It seems to default to rounded ends, which looks very bad for several lines in a row of dif
Maybe ExtCreatePen helps. Check the PS_ENDCAP_*
and PS_JOIN_*
flags.
Sample code from DelphiPraxis forum (German language)
procedure TForm1.FormCreate(Sender: TObject);
var LogBrush:TLOGBRUSH;
begin
ZeroMemory(@LogBrush, SizeOf(LogBrush));
LogBrush.lbColor:=ColorToRGB(Canvas.Pen.Color);
LogBrush.lbHatch:=0;
DeleteObject(Canvas.Pen.Handle);
Canvas.Pen.Handle:=ExtCreatePen(PS_Geometric or PS_Solid or PS_EndCap_Square or PS_Join_Miter, 10, LogBrush, 0, nil);
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.MoveTo(0, 0);
Canvas.LineTo(50, 50);
end;