Belajar operasi teks pada delphi sangat mudah dan sederhana..mau tau caranya cekidot gann...!
Untuk Font Style "Bold, Italic, Underline" menambahkan 1 Combobox yaitu " Combobox 4" dengan listing Program yang di Blok hijau
LISTING PROGRAM
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
combobox1.Items:=screen.Fonts;
combobox1.Text:='-PILIH FONTS-';
combobox2.Text:='-PILIH SIZE-';
combobox3.Text:='-PILIH BACK COLOR-';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
memo1.Text:=uppercase(edit1.Text);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
memo1.Text:=lowercase(edit1.Text);
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
memo1.Font.name:=combobox1.Text;
end;
procedure TForm1.ComboBox2Change(Sender: TObject);
begin
memo1.Font.Size:=strtoint(combobox2.Text);
end;
procedure TForm1.ComboBox3Change(Sender: TObject);
begin
if combobox3.text='merah'then
memo1.Color:=clred
else if combobox3.text='biru'then
memo1.Color:=clblue
else memo1.Color:=clgreen;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
memo1.Font.Color:=clred;
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
memo1.Font.Color:=clgreen;
end;
procedure TForm1.RadioButton3Click(Sender: TObject);
begin
memo1.Font.Color:=clyellow;
end;
procedure TForm1.RadioButton4Click(Sender: TObject);
begin
memo1.Font.Color:=clpurple;
end;
procedure TForm1.RadioButton5Click(Sender: TObject);
begin
memo1.Font.Color:=clblack;
end;
procedure TForm1.RadioButton6Click(Sender: TObject);
begin
memo1.Font.Color:=clblue;
end;
procedure TForm1.ComboBox4Change(Sender: TObject);
begin
if combobox4.Text='Bold' then
memo1.Font.Style:=memo1.Font.Style+[fsbold]
else if combobox4.Text='Italic' then
memo1.Font.Style:=memo1.Font.Style+[fsitalic]
else if combobox4.Text='Underline' then
memo1.Font.Style:=memo1.Font.Style+[fsunderline]
else memo1.Font.Style:=memo1.Font.Style+[fsstrikeout]
end;
end.
Tidak ada komentar:
Posting Komentar