unit Uhr;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Winkel: TEdit;
Strich: TButton;
Reset: TButton;
PaintBox1: TPaintBox;
procedure PaintBox1Paint(Sender: TObject);
procedure ResetClick(Sender: TObject);
procedure StrichClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
i : integer;
implementation
{$R *.dfm}
procedure TForm1.PaintBox1Paint(Sender: TObject);
var
LCanvas: TCanvas;
begin
LCanvas := TPaintBox(Sender).Canvas;
LCanvas.Ellipse(100,100,400,400);
// Kreis zeichnen
end;
procedure TForm1.ResetClick(Sender: TObject);
begin
paintbox1.Repaint ;
// Clear
end;
procedure TForm1.StrichClick(Sender: TObject);
var Radi, Gradi, R, PX, PY : double ;
MX, MY, PXi, PYi : integer ;
begin
MX := 250;
// Mittelpunkt
MY := 250;
R := 150;
Canvas.MoveTo(MX,MY);
//Canvas.lineto(280,125);
Gradi := StrToFloat(Winkel.Text) ;
Radi := 3.14 *(Gradi/180);
// Rechnung
PX := cos(Radi)* R + MX ;
PY := MY-sin(Radi)* R;
PXi := trunc(PX) ;
// Von ??? zu Integer umwandeln
PYi := trunc(PY) ;
Canvas.lineTo(PXi,PYi) ;
end;
end.