Einzelnen Beitrag anzeigen

mr_emre_d
(Gast)

n/a Beiträge
 
#5

Re: Kreis zeichnen mit gestrichelter Linie und Stärke mehr a

  Alt 6. Mai 2009, 21:53
Ich habe nichts zu tun .. (langeweile):

Delphi-Quellcode:
procedure DashEllipse( ACanvas: TCanvas; const Center: TPoint;
  const Radius: Cardinal; const PenWidth: Byte = 1;
  const Distance: Byte = 4 );
var
  i, x: Integer;
begin
  X := (360 div Distance);
  with ACanvas do
  begin
    Pen.Width := PenWidth;
    for i := 0 to X do
      if i mod 2 = 0 then
        Arc(
          Center.X-Radius, Center.Y-Radius, Center.X+Radius, Center.Y+Radius,
          Center.X + Round( cos( i*Distance*PI/180)*Radius ) , Center.Y + Round( sin( i*Distance*PI/180)*Radius ),
          Center.X + Round( cos( (i*Distance-Distance)*PI/180)*Radius ) , Center.Y + Round( sin( (i*Distance-Distance)*PI/180)*Radius )
        );
  end;
end;
Beispielsaufruf:
Delphi-Quellcode:

procedure TForm1.FormPaint(Sender: TObject);
begin
  DashEllipse( Canvas, Point( 200, 120 ), 100, 3 );
end;
MfG
  Mit Zitat antworten Zitat