delphin代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

颜色:

if colordialog1.Execute then

memo1.Color:=colordialog1.Color;

字体:

if fontdialog1.Execute then

memo1.Font:=fontdialog1.Font;

工具栏:左对齐:memo1.Alignment:=taleftjustify;

m_optionleft.Checked:=true;

m_optioncenter.Checked:=false;

m_optionright.Checked:=false;

radiogroup1.ItemIndex:=0;

居中:memo1.Alignment:=tacenter;

m_optionleft.Checked:=false; //选中标记

m_optioncenter.Checked:=true;

m_optionright.Checked:=false;

radiogroup1.ItemIndex:=1; //单选按钮组第一项被选中右对齐:memo1.Alignment:=tarightjustify;

m_optionleft.Checked:=false; //选中标记

m_optioncenter.Checked:=false;

m_optionright.Checked:=true;

radiogroup1.ItemIndex:=2; //单选按钮组第一项被选中//设置颜色

procedure TForm1.btn_colorClick(Sender: TObject); begin

if colordialog1.Execute then

memo1.Color:=colordialog1.Color;

end;

//设置字体

procedure TForm1.btn_fontClick(Sender: TObject); begin

if fontdialog1.Execute then

memo1.Font:=fontdialog1.Font;

end;

//更改内容

procedure TForm1.btn_textClick(Sender: TObject); begin

memo1.ReadOnly:=not memo1.ReadOnly;

end;

//按钮组中设定对齐方式

procedure TForm1.RadioGroup1Click(Sender: TObject); begin

case radiogroup1.ItemIndex of

0: begin //左对齐

memo1.Alignment:=taleftjustify;

m_optionleft.Checked:=true; //菜单项选中标记

m_optioncenter.Checked:=false;

m_optionright.Checked:=false;

end;

1: begin //居中

memo1.Alignment:=tacenter;

m_optionleft.Checked:=false;

m_optioncenter.Checked:=true;

m_optionright.Checked:=false;

end;

2: begin //右对齐

memo1.Alignment:=tarightjustify;

m_optionleft.Checked:=false;

m_optioncenter.Checked:=false;

m_optionright.Checked:=true;

end;

//居中菜单命令项

procedure TForm1.m_optioncenterClick(Sender: TObject); begin

memo1.Alignment:=tacenter;

m_optionleft.Checked:=false; //选中标记

m_optioncenter.Checked:=true;

m_optionright.Checked:=false;

radiogroup1.ItemIndex:=1; //单选按钮组第一项被选中end;

//左对齐菜单命令项

procedure TForm1.m_optionleftClick(Sender: TObject); begin

memo1.Alignment:=taleftjustify;

m_optionleft.Checked:=true;

m_optioncenter.Checked:=false;

m_optionright.Checked:=false;

radiogroup1.ItemIndex:=0;

end;

//右对齐菜单命令项

procedure TForm1.m_optionrightClick(Sender: TObject); begin

memo1.Alignment:=tarightjustify;

m_optionleft.Checked:=false; //选中标记

m_optioncenter.Checked:=false;

m_optionright.Checked:=true;

radiogroup1.ItemIndex:=2; //单选按钮组第一项被选中end;

//"隐藏"帮助菜单标题项

procedure TForm1.m_optionhideClick(Sender: TObject); begin

m_help.Visible:=not m_help.Visible;

if m_help.Visible then

m_optionhide.Caption:='隐藏'

else

m_optionhide.Caption:='显示'

end;

//工具栏中“加粗“

procedure TForm1.ToolButton8Click(Sender: TObject); begin

if toolbutton8.Down then

memo1.Font.Style:=memo1.Font.Style+[fsbold] else memo1.Font.Style:=memo1.Font.Style-[fsbold]

end;

//倾斜

procedure TForm1.ToolButton9Click(Sender: TObject); begin

if toolbutton9.Down then

memo1.Font.Style:=memo1.Font.Style+[fsItalic] else memo1.Font.Style:=memo1.Font.Style-[fsItalic]

end;

//下划线

procedure TForm1.ToolButton10Click(Sender: TObject); begin

if toolbutton10.Down then

memo1.Font.Style:=memo1.Font.Style+[fsUnderline] else memo1.Font.Style:=memo1.Font.Style-[fsUnderline] end;

相关文档
最新文档