如果我想通过button1的onclick事件 在richedit1中增加
一个字符串
默认颜色的'11111'+ 红颜色的'2222' 该如何实现?
一个字符串
默认颜色的'11111'+ 红颜色的'2222' 该如何实现?
解决方案 »
- [Error] UnitPgmList.pas(263): Type of expression must be BOOLEAN
- 如何将这张图片分解成三个图片(要圆角边)
- DELPHI里面用什么函数产生唯一识别码GUID??????????????
- Qreport 4.03,三星的ML-1610打印机怎么设置就是无法打印横向页面,纵向就没问题~!
- Delpih 中的Windows API编程
- 安装运行Delphi 7.0 后,如何启动?
- delphi帮助文件问题
- 文本文档自动换行的处理
- 各位前辈帮我看看这个奇怪的问题?
- 拉有免费软件的上传空间??????
- MDI窗口问题
- 在delphi里用clientdataset 如何调用sql server 的存储过程
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;type
TForm1 = class(TForm)
RichEdit1: TRichEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
RichEdit1.Clear;
RichEdit1.Lines.Add('1111');
RichEdit1.SelAttributes.Color := clRed;
RichEdit1.Lines.Add('222');end;procedure TForm1.Button2Click(Sender: TObject);
var
s1,s2 : string;
begin
RichEdit1.Clear;
s1 := '1111';
s2 := '2222';
RichEdit1.Lines.Add(s1+s2);
RichEdit1.SelStart := length(s1);
RichEdit1.SelLength := length(s2);
RichEdit1.SelAttributes.Color := clRed;end;end.