unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, jpeg;
type
TForm1 =
class(TForm)
Label1: TLabel;
zaehler: TEdit;
reset: TButton;
zaehler2: TEdit;
Label2: TLabel;
Label3: TLabel;
Image1: TImage;
ListBox: TListBox;
berechnen: TButton;
schliessen: TButton;
ergebnis: TLabel;
Timer: TTimer;
fehler1: TLabel;
Image2: TImage;
DatumUhr1: TLabel;
procedure berechnenClick(Sender: TObject);
procedure schliessenClick(Sender: TObject);
procedure resetClick(Sender: TObject);
procedure TimerTimer(Sender: TObject);
procedure Image1Click(Sender: TObject);
procedure Image2Click(Sender: TObject);
procedure zaehlerKeyPress(Sender: TObject;
var Key: Char);
procedure zaehler2KeyPress(Sender: TObject;
var Key: Char);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
a,b: real;
implementation
{$R *.DFM}
procedure TForm1.berechnenClick(Sender: TObject);
var a, b: real;
begin
a:= StrtoFloat(zaehler.Text);
b:= StrtoFloat(zaehler2.Text);
if ListBox.selected[0]
then ergebnis.Caption:= FloattoStrF(a + b,ffFixed,10,4);
if ListBox.selected[1]
then ergebnis.Caption:= FloattoStrF(a - b,ffFixed,10,4);
if ListBox.selected[2]
then ergebnis.Caption:= FloattoStrF(a * b,ffFixed,10,4);
if (ListBox.selected[3])
and (b=0)
then begin
Showmessage('
Durch 0 darf nicht geteilt werden!')
end;
if (ListBox.selected[3])
and (b <> 0)
then
ergebnis.Caption:= FloattoStrF(a / b,ffFixed,10,4);
if (a>=9999999999999999)
or (b>=9999999999999999)
then begin ShowMessage('
Die Zahl ist zu groß')
end;
end;
procedure TForm1.schliessenClick(Sender: TObject);
begin
Close();
end;
procedure TForm1.resetClick(Sender: TObject);
begin
zaehler.Clear;
zaehler2.Clear;
ergebnis.Caption:='
Ergebnis'
end;
procedure TForm1.TimerTimer(Sender: TObject);
begin
DatumUhr1.Caption:=DateTimeToStr(Now)+ '
Uhr';
end;
procedure TForm1.Image1Click(Sender: TObject);
begin
Showmessage('
Artwork © by Yana Toboso');
end;
procedure TForm1.Image2Click(Sender: TObject);
begin
Showmessage('
Artwork © by Yana Toboso and edited by us')
end;
procedure TForm1.zaehlerKeyPress(Sender: TObject;
var Key: Char);
begin
if not (Key
in ['
0'..'
9',#08,'
,'])
then begin
key:= #0;
Beep;
end;
end;
procedure TForm1.zaehler2KeyPress(Sender: TObject;
var Key: Char);
begin
if not (Key
in ['
0'..'
9',#08,'
,'])
then begin
key:= #0;
Beep;
end;
end;
end.