Einzelnen Beitrag anzeigen

Skiron

Registriert seit: 14. Dez 2003
153 Beiträge
 
#5

Re: Polygone mit Pfeilen zeichnen

  Alt 18. Mai 2004, 16:55
Ich hab was zusammengestellt
Probier mal diesen Source:
Delphi-Quellcode:
procedure TForm1.ZeichneKantenpfeil(x1, y1: Integer; x2, y2: Integer);
const
  wf = pi/8;
  L = 20;
var
  dx, dy: Integer;
  w: Real;
  p: TPoint;
begin
  dx := x2 - x1;
  dy := y2 - y1;
  w := ArcCos(dx / sqrt(sqr(dx) + sqr(dy)));
  if dy > 0 then
     w := (2 * Pi) - w;
  p := Point((x1 + x2) div 2, (y1 + y2) div 2);
  with Image1.Canvas do begin
    MoveTo(p.x, p.y);
    LineTo(p.x - round(cos(w + wf) * L),
           p.y + round(sin(w + wf) * L));
    LineTo(p.x - round(cos(w - wf) * L),
           p.y + round(sin(w - wf) * L));
    LineTo(p.x, p.y);
  end;
end;
Mann zu Frau:
Zieh dich aus, wir müssen reden!
  Mit Zitat antworten Zitat