Labels

Selasa, 08 Februari 2011

Membuat Aplikasi Kalkulator Dengan Delphi

Untuk para pencinta delphi ada tutorial simple ni buat di pelajarin tolong di bantu y . .hehe

Dari pada Fb an yang di ajak chat gk bales² kan jadi bete.mending diliat dulu ni tutor.Siapa tau kita bisa buat aplikasi kalkulator sendiri dengan delphi.

Silahkan lihat ja codingnya…
unit Unit1;

interface

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

type
TForm1 = class(TForm)
Image1: TImage;
Panel1: TPanel;
Edit1: TEdit;
Button1: TButton;
Panel2: TPanel;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Button18: TButton;
Button19: TButton;
Panel3: TPanel;
Button3: TButton;
Button2: TButton;
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure Button19Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button18Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
operasi,nilai1,nilai2,hasil:Integer;
implementation

{$R *.dfm}

procedure TForm1.Button8Click(Sender: TObject);
var
one : Integer;
begin
one := 1;
Edit1.Text := Edit1.Text + IntToStr(one);

end;

procedure TForm1.Button9Click(Sender: TObject);
var
two : Integer;
begin
two := 2;
Edit1.Text := Edit1.Text + IntToStr(two);
end;

procedure TForm1.Button10Click(Sender: TObject);
var
tree : Integer;
begin
tree := 3;
Edit1.Text := Edit1.Text + IntToStr(tree);
end;

procedure TForm1.Button11Click(Sender: TObject);
var
four : Integer;
begin
four := 4;
Edit1.Text := Edit1.Text + IntToStr(four);
end;

procedure TForm1.Button12Click(Sender: TObject);
var
five : Integer;
begin
five := 5;
Edit1.Text := Edit1.Text + IntToStr(five);
end;

procedure TForm1.Edit1Change(Sender: TObject);
begin
Edit1.Color:=clRed;
end;

procedure TForm1.Button13Click(Sender: TObject);
var
six : Integer;
begin
six := 6;
Edit1.Text := Edit1.Text + IntToStr(six);

end;

procedure TForm1.Button14Click(Sender: TObject);
var
seven : Integer;
begin
seven := 7;
Edit1.Text := Edit1.Text + IntToStr(seven);
end;

procedure TForm1.Button15Click(Sender: TObject);
var
eight : Integer;
begin
eight := 8;
Edit1.Text := Edit1.Text + IntToStr(eight);
end;

procedure TForm1.Button16Click(Sender: TObject);
var
nine : Integer;
begin
nine := 9;
Edit1.Text := Edit1.Text + IntToStr(nine);
end;

procedure TForm1.Button17Click(Sender: TObject);
begin
Edit1.Text:=”;
end;

procedure TForm1.Button19Click(Sender: TObject);
var
zero : Integer;
begin
zero := 0;
Edit1.Text := Edit1.Text + IntToStr(zero);

end;

procedure TForm1.Button4Click(Sender: TObject);
begin
operasi:=1;
nilai1:=StrToInt(Edit1.Text);
Edit1.Text:=”;
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
operasi:=2;
nilai1:=StrToInt(Edit1.Text);
Edit1.Text:=”;
end;

procedure TForm1.Button6Click(Sender: TObject);
begin
operasi:=3;
nilai1:=StrToInt(Edit1.Text);
Edit1.Text:=”;
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
operasi:=4;
nilai1:=StrToInt(Edit1.Text);
Edit1.Text:=”;
end;

procedure TForm1.Button18Click(Sender: TObject);
begin
nilai2:=StrToInt(Edit1.Text);
case operasi of
1: hasil := nilai1 * nilai2;
2: hasil := nilai1 div nilai2;
3: hasil := nilai1 + nilai2;
4: hasil := nilai1 – nilai2;
end;
Edit1.Text:=IntToStr(hasil);

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
Panel1.Enabled:=True;
Panel2.Enabled:=True;
Panel3.Enabled:=True;
Edit1.SetFocus;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
Panel1.Enabled:=False;
Panel2.Enabled:=False;
Edit1.Color:=clWindow;
end;

procedure TForm1.FormActivate(Sender: TObject);
begin
Panel1.Enabled:=False;
Panel2.Enabled:=False;
end;

end.

Interfacenya gini nih…

Silahkan di coba…
Silahkan di coba…
Referensi : http://indonesianfree.wordpress.com/2011/01/06/membuat-aplikasi-kalkulator-dengan-delphi-7
Related Posts Plugin for WordPress, Blogger...