unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, PaintBox1;
type
TForm1 =
class(TForm)
radiuslbl: TLabel;
radiusedit: TEdit;
winkellbl: TLabel;
winkeledit: TEdit;
laengelbl: TLabel;
laengeedit: TEdit;
RadioGroup1: TRadioGroup;
umfangbut: TButton;
flaechebut: TButton;
laengebut: TButton;
winkelbut: TButton;
flaechekreisbut: TButton;
bogenbut: TButton;
Panel1: TPanel;
resultlbl: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
neubut: TButton;
pb1: TPaintBox1;
edt1: TEdit;
procedure FormCreate(Sender: TObject);
procedure setzenbutClick(Sender: TObject);
procedure umfangbutClick(Sender: TObject);
procedure flaechebutClick(Sender: TObject);
procedure laengebutClick(Sender: TObject);
procedure winkelbutClick(Sender: TObject);
procedure flaechekreisbutClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure neubutClick(Sender: TObject);
procedure edt1KeyPress(Sender: TObject;
var Key: Char);
procedure pb1Paint(Sender: TObject);
private
{ Private-Deklarationen }
FRadius: integer;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
umfangbut.Enabled := false;
flaechebut.Enabled := false;
bogenbut.Enabled := false;
winkelbut.Enabled := false;
laengebut.Enabled := false;
flaechekreisbut.Enabled := false;
radiuslbl.Enabled := false;
radiusedit.Enabled := false;
winkellbl.Enabled := false;
winkeledit.Enabled := false;
laengelbl.Enabled := false;
laengeedit.Enabled := false;
neubut.Enabled := false;
FRadius := 0;
end;
procedure TForm1.setzenbutClick(Sender: TObject);
begin
radiuslbl.Enabled := false;
radiusedit.Enabled := false;
winkellbl.Enabled := false;
winkeledit.Enabled := false;
laengelbl.Enabled := false;
laengeedit.Enabled := false;
umfangbut.Enabled := true;
flaechebut.Enabled := true;
bogenbut.Enabled := true;
winkelbut.Enabled := true;
laengebut.Enabled := true;
flaechekreisbut.Enabled := true;
end;
procedure TForm1.umfangbutClick(Sender: TObject);
VAR Radius : REAL;
begin
Radius := StrToFloat(radiusedit.Text);
resultlbl.Caption := FloatToStr(Radius*2*Pi);
neubut.Enabled := true;
end;
procedure TForm1.flaechebutClick(Sender: TObject);
VAR Radius : REAL;
begin
Radius := StrToFloat(radiusedit.Text);
resultlbl.Caption := FloatToStr(Radius*Radius*Pi);
end;
procedure TForm1.laengebutClick(Sender: TObject);
VAR winkel : REAL;
Var radius : Real;
begin
radius := StrToFloat(radiusedit.Text);
winkel := StrToFloat(winkeledit.Text);
resultlbl.Caption := FloatToStr(winkel/180*radius*Pi);
end;
procedure TForm1.winkelbutClick(Sender: TObject);
VAR laenge : REAL;
begin
laenge := StrToFloat(laengeedit.Text);
resultlbl.Caption := FloatToStr(laenge/Pi*180);
end;
procedure TForm1.flaechekreisbutClick(Sender: TObject);
VAR Radius : REAL;
var winkel : Real ;
begin
Radius := StrToFloat(radiusedit.Text);
winkel := StrToFloat(winkeledit.Text);
resultlbl.Caption := FloatToStr(winkel/360*radius*radius*Pi);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
radiuslbl.Enabled := true;
radiusedit.Enabled := true;
Button2.Enabled := false;
Button3.Enabled := false;
Button4.Enabled := false;
Button5.Enabled := false;
Button6.Enabled := false;
Button1.Enabled := false;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
radiuslbl.Enabled := false;
radiusedit.Enabled := false;
winkellbl.Enabled := false;
winkeledit.Enabled := false;
laengelbl.Enabled := false;
laengeedit.Enabled := false;
Button7.Enabled := false;
umfangbut.Enabled := true;
end;
procedure TForm1.neubutClick(Sender: TObject);
begin
umfangbut.Enabled := true;
flaechebut.Enabled := true;
bogenbut.Enabled := true;
winkelbut.Enabled := true;
laengebut.Enabled := true;
flaechekreisbut.Enabled := true;
radiuslbl.Enabled := true;
radiusedit.Enabled := true;
winkellbl.Enabled := true;
winkeledit.Enabled := true;
laengelbl.Enabled := true;
laengeedit.Enabled := true;
resultlbl.Caption := FloatToStr(0*0);
end;
procedure TForm1.edt1KeyPress(Sender: TObject;
var Key: Char);
begin
if Key = #13
then
begin
Key := #0;
FRadius := StrToIntDef(edt1.Text,0);
pb1.repaint;
end;
end;
procedure TForm1.pb1Paint(Sender: TObject);
const Start = 100;
var Kantenlaenge: Integer;
begin
with pb1
do
begin
Canvas.Pen.Color := clRed;
SetMapMode(Canvas.Handle, MM_LOMETRIC);
Kantenlaenge := FRadius * 20 + Start;
Ellipse(Canvas.Handle,pb1.Left + Start,-(pb1.Top + Start),pb1.Left + Kantenlaenge,-(pb1.Top + Kantenlaenge));
end;
end;
end.