Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Library: Grafik / Sound / Multimedia (https://www.delphipraxis.net/21-library-grafik-sound-multimedia/)
-   -   Delphi TCanvas.LineTo ohne abgerundete Ecken (https://www.delphipraxis.net/93142-tcanvas-lineto-ohne-abgerundete-ecken.html)

Meflin 1. Jun 2007 11:48


TCanvas.LineTo ohne abgerundete Ecken
 
Moin moin.

Standardmäßig werden bei der LineTo-Methode eines TCanvas die Ecken der Linie abgerundet gezeichnet. Wer das nicht möchte und lieber echte eckige Ecken hat, kann dies mit Hilfe der Funktion MSDN-Library durchsuchenExtCreatePen erreichen.

Verwenden kann man die beispielsweiße so:
Delphi-Quellcode:
const
  SquarePenStyle = PS_GEOMETRIC or PS_ENDCAP_SQUARE or PS_JOIN_BEVEL;

procedure SetPen(Canvas: TCanvas; Color: TColor;
  Width: Integer; Style: TPenStyle);
var
  LogBrush: TLogBrush;
begin
  ZeroMemory(@LogBrush, SizeOf(LogBrush));
  LogBrush.lbColor := ColorToRGB(Color);
  LogBrush.lbHatch := 0;
  Canvas.Pen.Handle := ExtCreatePen(SquarePenStyle or Ord(Style), Width,
    LogBrush, 0, nil);
end;
Beispielaufruf:
Delphi-Quellcode:
SetPen(Canvas, clBlack, 10, psDashDotDot);
Canvas.MoveTo(10, 10);
Canvas.LineTo(200, 200);


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:32 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz