Thema: Polygon

Einzelnen Beitrag anzeigen

mr_emre_d
(Gast)

n/a Beiträge
 
#3

Re: Polygon

  Alt 19. Mär 2009, 20:43
Hier, der per PN verlangte vollständige Quellcode...

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs;

type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormPaint(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

  TPolygon = Array of TPoint;

var
  Form1: TForm1;
  Dreieck: TPolygon;

implementation

{$R *.dfm}

procedure CreateTriangle( var Polygon: TPolygon; const Edge1, Edge2, Edge3: TPoint );
begin
  SetLength( Polygon, 3 );
  Polygon[0] := Edge1;
  Polygon[1] := Edge2;
  Polygon[2] := Edge3;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  CreateTriangle( Dreieck, Point( 100, 100 ), Point( 150, 50 ), Point( 200, 100 ) );
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  Canvas.Polygon( Dreieck );
end;

end.
  Mit Zitat antworten Zitat