RichEdit1

//RichEdit1 
// 设置颜色Color
{
设置颜色后开始选中的部分仍然是选中的
}

//richedit1.SelAttributes.Color


procedure TForm1.Button1Click(Sender: TObject);
begin
    RichEdit1.SelAttributes.Color := clRed;
end;

// 对ColorBox1
procedure TForm1.Button5Click(Sender: TObject);
begin
    RichEdit1.SelAttributes.Color:=ColorBox1.Selected;
end;

//对ColorListBox1
procedure TForm1.Button6Click(Sender: TObject);
begin
   RichEdit1.SelAttributes.Color:=ColorListBox1.Selected;
end;

//设置风格Style
//richedit1.SelAttributes.Style
{
如果要一次性设置多个文字样式的话,在中括号中用逗号隔开
richedit1.SelAttributes.Style:=[fsBold,fsItalic,fsUnderline,fsStrikeOut];
}

procedure TForm1.Button3Click(Sender: TObject);
begin
   RichEdit1.SelAttributes.Style :=[fsUnderline];
end;

//设置文字大小
procedure TForm1.Button8Click(Sender: TObject);
begin
    RichEdit1.SelAttributes.Size:=20;
end;

//面向FontDialog1
procedure TForm1.Button3Click(Sender: TObject);
begin
    if FontDialog1.Execute then
    begin
        RichEdit1.SelAttributes.Assign(FontDialog1.Font);
    end
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
    if FontDialog1.Execute then
    begin
        RichEdit1.DefAttributes.Assign(FontDialog1.Font);
    end
end;


//全部属性设置
procedure TForm1.Button1Click(Sender: TObject);
begin
  RichEdit1.Font := FontDialog1.Font;
end;


//RichEdit 自动换行
procedure TForm1.Button1Click(Sender: TObject);
begin
  RichEdit1.WordWrap:=True;
end;


//with... do
procedure TForm1.Button1Click(Sender: TObject);
begin
  with RichEdit1.SelAttributes do
  begin
    Color:=clBlue;
    Height:=30;
    Style:=[fsUnderline];
  end;
end;

//设置默认属性DefAttributes -> DefaultAttributes
procedure TForm1.FormCreate(Sender: TObject);
begin
  with RichEdit1.DefAttributes do
  begin
      Height:=20;
      Color:=clGreen;
      Font.Name :='微软雅黑';
      Style:=[fsBold,fsItalic];
  end;
end;



//
procedure TForm1.FormCreate(Sender: TObject);
begin
  RichEdit1.DefAttributes.Color:=clRed;
end;
//在RichEdit中插入位图 Gif
//超链接
//




转载于:https://www.cnblogs.com/xe2011/archive/2012/06/02/2531628.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值