zoukankan      html  css  js  c++  java
  • 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
    //超链接
    //




  • 相关阅读:
    突破极验验证的验证码
    c# 自定义多选下拉列表2
    c#多选下拉框(ComboBox)
    图片缩放+拖动(html)
    使用天天模拟器开发android应用
    FineUI开源版之TreeGrid(修改)
    FineUI开源版之TreeGrid实现
    c# 窗体最小化后截图实现
    c#一个简单的实例告诉你,多继承还可以这么来
    设置控件Enable=false,控件颜色不变
  • 原文地址:https://www.cnblogs.com/xe2011/p/2531628.html
Copyright © 2011-2022 走看看