为了我按照下面代码写,但是没有对相应文字选择呢?
with richedit do
begin
istart :=Length(Text);
Lines.Add ('今天你好') ;
iPos:=Length(Text);
SelLength :=iPos-istart;
SelAttributes.Color:=clRed ;
end;
“今天你好”没有变成红色,这是为什么?
with richedit do
begin
istart :=Length(Text);
Lines.Add ('今天你好') ;
iPos:=Length(Text);
SelLength :=iPos-istart;
SelAttributes.Color:=clRed ;
end;
“今天你好”没有变成红色,这是为什么?
解决方案 »
- 关于PChar
- TreeView1即时更新显示数据,要怎么操作?
- 新手上路 高手帮忙下 新手1756
- StrToFloat 问题,不知道什么问题了
- 在线等待:安装了FORMONE6,可是再Delphi6中导入Active控件时总不成功,请执教!
- 一个很简单的问题
- 200分求李维先生的《Delphi5.X分布式多层应用系统篇》随书源码,请上传到我的FTP
- 求救!
- 怎么把label的值显示为20,000.00
- 老大:我用Delphi6写WebSnap或WebServices用下面什么类型的??比较有执行效率?.....................
- Delphi中RS232接口的发送程序问题
- 快速检测网络是否连接
SelStart :=Length(Text);
Lines.Add ('½ñÌìÄãºÃ') ;
iPos:=Length(Text);
SelLength :=iPos-selstart; SelAttributes.Color:=clRed ;
这样子还是不行
在button的click事件中写入下边的代码
procedure TForm1.Button2Click(Sender: TObject);
var
ipos:integer;
begin
with richedit1 do
begin
Lines.Add ('今天你好') ;
iPos:=Length(Text);
SelStart :=0;
SelLength :=iPos;
SelAttributes.Color:=clRed ;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ipos:integer;
begin
RichEdit1.Clear;
with RichEdit1 do
begin
Lines.Add ('今天你好') ;
iPos:=Length(Text);
SelStart :=0;
SelLength :=iPos;
SelAttributes.Color:=clRed ;
end;
end;
ipos:integer;
begin
with REdit1 do
begin
SelStart := Length(Text);
Lines.Add ('½ñÌìÄãºÃÂð') ;
iPos:=Length(Text);
SelLength :=iPos-selstart;
SelAttributes.Color:=clRed ;
end;
end;
SelStart :=0; //把这个修改成你文字的起始位置
procedure TForm1.Button1Click(Sender: TObject);
var
ipos:integer;
begin
RichEdit1.Text :='RichEdit1';
with RichEdit1 do
begin
Lines.Add ('今天你好') ;
iPos:=Length(Text);
SelStart :=9; //重要的是找到起始位置!
SelLength :=iPos;
SelAttributes.Color:=clRed;
end;
end;