Design form ini untuk membuat FONT TEST dengan menggunakan Delphi 7.
Cara membuatnya tidak sulit, sangat sederhana dan hanya
membutuhkan beberapa komponen yang ada di Menu Delphi 7. Untuk Lebihjelasnya
langsung saja ke TKP.Langkah pertama, siapkan form Delphi 7, seperti yang gambar di atas, komponen yang di butuhkan untuk membuat font test adalah sebagai berikut :
Komponen
|
Name
|
Caption
|
||
Form
|
Form1
|
FONT TEST (judul Program)
|
||
GroupBox
|
GroupBox1
|
(kosong)
|
||
GroupBox
|
GroupBox2
|
Font Aligment
|
||
GroupBox
|
GroupBox3
|
Font Style
|
||
GroupBox
|
GroupBox4
|
Font Color
|
||
RadioButton
|
RadioButton1
|
Rata Kiri
|
||
RadioButton
|
RadioButton2
|
Rata Tengah
|
||
RadioButton
|
RadioButton3
|
Rata Kanan
|
||
RadioButton
|
RadioButton4
|
Merah
|
||
RadioButton
|
RadioButton5
|
Biru
|
||
RadioButton
|
RadioButton6
|
Hijau
|
||
CheckBox
|
Checbox1
|
Miring
|
||
CheckBox
|
Checbox2
|
Tebal
|
||
CheckBox
|
Checbox3
|
Garis Bawah
|
||
Label
|
Label1
|
MASUKAN TEKS
|
||
Label
|
Label2
|
MASUKAN TEKS
|
||
Edit.Text
|
Edit1.text
|
(kosong)
|
||
Langkah kedua, masukkan script di bawah ini :
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) GroupBox1: TGroupBox; GroupBox2: TGroupBox; GroupBox3: TGroupBox; GroupBox4: TGroupBox; RadioButton1: TRadioButton; RadioButton2: TRadioButton; RadioButton3: TRadioButton; CheckBox1: TCheckBox; CheckBox2: TCheckBox; CheckBox3: TCheckBox; RadioButton4: TRadioButton; RadioButton5: TRadioButton; RadioButton6: TRadioButton; Label1: TLabel; Edit1: TEdit; Label2: TLabel; procedure RadioButton1Click(Sender: TObject); procedure RadioButton3Click(Sender: TObject); procedure CheckBox1Click(Sender: TObject); procedure CheckBox2Click(Sender: TObject); procedure CheckBox3Click(Sender: TObject); procedure RadioButton2Click(Sender: TObject); procedure RadioButton4Click(Sender: TObject); procedure RadioButton5Click(Sender: TObject); procedure RadioButton6Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Edit1Change(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.RadioButton1Click(Sender: TObject); begin Label1.Alignment:=taLeftJustify; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.RadioButton3Click(Sender: TObject); begin Label1.Alignment:=taRightJustify; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.CheckBox1Click(Sender: TObject); begin if CheckBox1.Checked = true then begin Label1.Font.Style:=Label1.Font.Style+[fsItalic]; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end else Label1.Font.Style:=Label1.Font.Style-[fsItalic]; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.CheckBox2Click(Sender: TObject); begin if CheckBox2.Checked = true then begin Label1.Font.Style:=Label1.Font.Style+[fsBold]; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end else Label1.Font.Style:=Label1.Font.Style-[fsBold]; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.CheckBox3Click(Sender: TObject); begin if CheckBox3.Checked = true then begin Label1.Font.Style:=Label1.Font.Style+[fsUnderline]; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end else Label1.Font.Style:=Label1.Font.Style-[fsUnderline]; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.RadioButton2Click(Sender: TObject); begin Label1.Alignment:=taCenter; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.RadioButton4Click(Sender: TObject); begin label1.Font.Color:=clRed; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.RadioButton5Click(Sender: TObject); begin label1.Font.Color:=clBlue; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.RadioButton6Click(Sender: TObject); begin label1.Font.Color:=clLime; Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; end; procedure TForm1.FormCreate(Sender: TObject); begin Label1.Height:= 393; Label1.Width:= 599; label1.Left:= 8; Label1.Top:=8; Label1.Alignment:=taCenter; end; procedure TForm1.Edit1Change(Sender: TObject); begin Label1.Caption:=Edit1.Text end; end.
Silahkan Di Compile, jika sudah
bisa di Compile maka Font Test ini telah siap digunakan. Tapi jika
masih ada yang error maka koreksi kembali script yang ada di Form dengan yang
ada pada postingan ini. Oke jangan lupa Di Simpan Project tadi, jika tidak di
simpan maka sia-sia kerja keras selama ini.
|
||||
Di gambar kok gak ada button nya?
BalasHapusitu memang dibuat tanpa button, jadi ketika radiobutton di pilih maka langsung di berjalan :)
Hapus