📄 unit1.pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
ListBox1: TListBox;
ScrollBar1: TScrollBar;
ScrollBar2: TScrollBar;
ScrollBar3: TScrollBar;
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
GroupBox1: TGroupBox;
RadioGroup1: TRadioGroup;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
procedure ScrollBar2Change(Sender: TObject);
procedure ScrollBar3Change(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure CheckBox3Click(Sender: TObject);
procedure CheckBox4Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
r,g,b:byte;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
memo1.Lines.Add('组合框用TEXT显示文本,STYLE表示组合框的风格');
memo1.Lines.Add('组合框用DropDownCount表示组合框下拉列表显示选项的最大行数');
memo1.Lines.Add('');
memo1.Lines.Add('列表框用Items显示文本,Selected设置或报告某选项是否被选中');
memo1.Lines.Add('Count表示列表框内选项的项数');
memo1.Lines.Add('Columns表示列表框的列数');
memo1.Lines.Add('SelCount表示列表框内被选中项目的数量');
memo1.Lines.Add('MultiSelect表示列表框是否可以选择多项');
memo1.Lines.Add('ItemsIndex表示列表框选项在Items数组中索引值,初值为0');
radiogroup1.Items.Add('红色(&R)');
radiogroup1.Items.Add('蓝色(&B)');
radiogroup1.Items.Add('绿色(&G)');
radiogroup1.Items.Add('黄色(&Y)');
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
memo1.Font.Size:=strtoint(combobox1.Text);
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var
s:string;
begin
s:=listbox1.Items[listbox1.ItemIndex];
memo1.Font.Name:=s;
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
r:=scrollbar1.Position;
memo1.Font.Color:=rgb(r,g,b);
end;
procedure TForm1.ScrollBar2Change(Sender: TObject);
begin
g:=scrollbar2.Position;
memo1.Font.Color:=rgb(r,g,b);
end;
procedure TForm1.ScrollBar3Change(Sender: TObject);
begin
b:=scrollbar3.Position;
memo1.Font.Color:=rgb(r,g,b);
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if checkbox1.Checked then
memo1.Font.Style:=memo1.Font.Style+[fsBold]
else
memo1.Font.Style:=memo1.Font.Style-[fsBold];
end;
procedure TForm1.CheckBox2Click(Sender: TObject);
begin
if checkbox2.Checked then
memo1.Font.Style:=memo1.Font.Style+[fsItalic]
else
memo1.Font.Style:=memo1.Font.Style-[fsItalic];
end;
procedure TForm1.CheckBox3Click(Sender: TObject);
begin
if checkbox3.Checked then
memo1.Font.Style:=memo1.Font.Style+[fsUnderline]
else
memo1.Font.Style:=memo1.Font.Style-[fsUnderline];
end;
procedure TForm1.CheckBox4Click(Sender: TObject);
begin
if checkbox4.Checked then
memo1.Font.Style:=memo1.Font.Style+[fsStrikeout]
else
memo1.Font.Style:=memo1.Font.Style-[fsStrikeout];
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
case radiogroup1.ItemIndex of
0:memo1.Font.Color:=clred;
1:memo1.Font.Color:=clblue;
2:memo1.Font.Color:=clgreen;
3:memo1.Font.Color:=clyellow;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -