Contoh Aplikasi penggunaan shape menggunakan lazarus


tampilan awal

ini source codenya,. 😀

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Buttons,
ColorBox, StdCtrls, ExtCtrls;

type

{ TForm1 }

TForm1 = class(TForm)
BitBtn1: TBitBtn;
ColorBox1: TColorBox;
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
Shape1: TShape;
Timer1: TTimer;
procedure BitBtn1Click(Sender: TObject);
procedure ColorBox1Change(Sender: TObject);
procedure Label1Click(Sender: TObject);
procedure Label2Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;

var
Form1: TForm1;
ADate: TDateTime;
hari: array[1..7] of string;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.ListBox1Click(Sender: TObject);
begin
case listbox1.ItemIndex of
0: shape1.Shape:=stSquare;
1: shape1.Shape:=stCircle;
2: shape1.Shape:=stEllipse;
3: shape1.Shape:=stRectangle;
4: shape1.Shape:=stRoundSquare;
5: shape1.Shape:=stRoundRect;
end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
hari[1]:= ‘Minggu’;
hari[2]:= ‘Senin’;
hari[3]:= ‘Selasa’;
hari[4]:= ‘Rabu’;
hari[5]:= ‘Kamis’;
hari[6]:= ‘Jumat’;
hari[7]:= ‘Sabtu’;
ADate := Date;
label1.Caption:=hari[DayOfWeek(ADate)]+’/’+datetimetostr(date);
label2.Caption:=formatdatetime(‘hh:nn:ss’, now);

end;

procedure TForm1.ColorBox1Change(Sender: TObject);
begin
shape1.Brush.Color:=colorbox1.Selected;
end;

procedure TForm1.Label1Click(Sender: TObject);
begin
label1.Caption;
end;

procedure TForm1.Label2Click(Sender: TObject);
begin
label2.Caption;
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
close;
end;

end.

tampilan saat dijalankan🙂

untuk aplikasinya silahkan download di sini.

semoga membantu  ^_^

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s