Monday, July 11, 2011

Penghitung Nilai [4 Rega]


unit Unit1;

interface

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

type
TForm1 = class(TForm)
//----------- Componnent yg dipakai--------------------------------------------->
Edit1: TEdit;
SpeedButton1: TSpeedButton;
Label1: TLabel;
Shape1: TShape;
Label2: TLabel;
//----------- Componnent yg dipakai--------------------------------------------->
procedure SpeedButton1Click(Sender: TObject);
private
{ Create By : Zephio }
public
{ http://amateur-guide.blogspot.com }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}


procedure TForm1.SpeedButton1Click(Sender: TObject);
var
I : Integer;
begin
I := StrToInt(Edit1.Text);
if (I <= 20) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClRed;
Label2.Caption := 'E = Sangat Payah';
Label2.Font.Color := ClRed
end
else
if (I <= 40) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClYellow;
Label2.Caption := 'D = Payah';
Label2.Font.Color := ClYellow
end
else
if (I <= 60) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClBlack;
Label2.Caption := 'C = Cukup';
Label2.Font.Color := ClBlack
end
else
if (I <= 80) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClBlue;
Label2.Caption := 'B = Bagus';
Label2.Font.Color := ClBlue
end
else
if (I <= 100) then
begin
Shape1.Brush.Style := BSSolid;
Shape1.Brush.Color := ClGreen;
Label2.Caption := 'A = Sangat Bagus';
Label2.Font.Color := ClGreen;
end;
end;
end.
DL SC : Click Here