Langsung saja ini tampilan interfacenya,,,

komponen yang digunakan adalah :
1.label
2.edit
3.combobox
4.button
5.image
ini souce codenya..
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
ComboBox1: TComboBox;
Edit3: TEdit;
XPManifest1: TXPManifest;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button3: TButton;
procedure ComboBox1Change(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.ComboBox1Change(Sender: TObject);
var
a,b,c:Real;
begin
a:=StrToFloat(Edit1.Text);
b:=StrToFloat(Edit2.text);
if ComboBox1.Text= '+'then
c:=a+b
else if ComboBox1.Text= '-' then
c:=a-b
else if ComboBox1.Text= '*' then
c:=a*b
else if ComboBox1.Text= '/' then
c:=a/b;
Edit3.Text:=FloatToStr(c);
end;
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if Key= #13 then
ComboBox1.SetFocus;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key= #13 then
Edit2.SetFocus;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlg('apkah anda ingin mereset?',mtConfirmation,[mbYes,mbNo],32)=mryes
then
Edit1.Text:=' ';
Edit2.Text:=' ';
Edit3.Text:=' ';
ComboBox1.Text:=' ';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if MessageDlg('apakah anda yakin ingin keluar?',mtWarning,[mbYes,mbNo],0)=mryes then Close;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Form1.Hide;
form2.show;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Button1: TButton;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Image1: TImage;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
Form2.Close;
form1.show;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
if MessageDlg('Panjenengan leres pengen medal ?',mtWarning,[mbYes,mbNo],0)= mryes
then
Form2.Close;
Form1.Close;
end;
end.

komponen yang digunakan adalah :
1.label
2.edit
3.combobox
4.button
5.image
ini souce codenya..
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
ComboBox1: TComboBox;
Edit3: TEdit;
XPManifest1: TXPManifest;
Button1: TButton;
Button2: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Button3: TButton;
procedure ComboBox1Change(Sender: TObject);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.ComboBox1Change(Sender: TObject);
var
a,b,c:Real;
begin
a:=StrToFloat(Edit1.Text);
b:=StrToFloat(Edit2.text);
if ComboBox1.Text= '+'then
c:=a+b
else if ComboBox1.Text= '-' then
c:=a-b
else if ComboBox1.Text= '*' then
c:=a*b
else if ComboBox1.Text= '/' then
c:=a/b;
Edit3.Text:=FloatToStr(c);
end;
procedure TForm1.Edit2KeyPress(Sender: TObject; var Key: Char);
begin
if Key= #13 then
ComboBox1.SetFocus;
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key= #13 then
Edit2.SetFocus;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlg('apkah anda ingin mereset?',mtConfirmation,[mbYes,mbNo],32)=mryes
then
Edit1.Text:=' ';
Edit2.Text:=' ';
Edit3.Text:=' ';
ComboBox1.Text:=' ';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if MessageDlg('apakah anda yakin ingin keluar?',mtWarning,[mbYes,mbNo],0)=mryes then Close;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Form1.Hide;
form2.show;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, jpeg, ExtCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Button1: TButton;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Image1: TImage;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
uses Unit1;
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
begin
Form2.Close;
form1.show;
end;
procedure TForm2.Button2Click(Sender: TObject);
begin
if MessageDlg('Panjenengan leres pengen medal ?',mtWarning,[mbYes,mbNo],0)= mryes
then
Form2.Close;
Form1.Close;
end;
end.
bagi pemula Delphi sangat mambantu dalam proses pembelajaran..
BalasHapusTQ sudah berkunjung gan
BalasHapusClick to see the code!
To insert emoticon you must added at least one space before the code.