当用户点击按纽,richedit1.seltext:='abc'.现在我想让abc用蓝色显示出来,然后以后在richedit1中输入的字符串还是用系统默认的黑色,现在问题是如果我用richedit1.Font.Color=clblue,呆会在richedit输入其它字符,它也会认为为是蓝色
解决方案 »
- 急!像Vb的datagrid功能??
- 求IVR源码(急!!!!)
- 大家对delphi的组件都熟悉到什么程度呢?
- 制作添加用户窗体问题 在线等待
- ?delphi7.0装在winn2000server上加载Qreport面板中的第一个控件QuickRpt时出现“Access Violation at address 40006948 in module 'rtl70
- 出问题了,HELP!!关于动态产生WebBrowser2控件!
- 批处理图片
- 如何在BeforPost事件中控制Post的操作
- <<<<< 如何在memo和strea中转化?
- 请各位高手推荐几本好书
- 高分求DELPHI4.0中的哪个做安装程序的工具,只要这个版本的!
- 求教:怎么样遍历一组组件(如edit)?请看内容.
var i_Pos,:integer;
begin
i_Pos:=pos('abc',richedit1.Text);
if i_Pos>0 then
begin
richedit1.SelStart:=i_Pos - 1;
richedit1.SelLength:=3;
richedit1.SelAttributes.Color:=clred;
end;
end;
var i_Pos,i_Last,StrLen:integer;
Str,FindStr:string;
begin
str:=richedit1.Text;
FindStr:='abc';
StrLen:=Length(FindStr);
i_Last:=0; i_Pos:=pos(FindStr,str);
delete(str,1,i_Pos + StrLen - 1); while i_Pos>0 do
begin
i_Last:=i_Last + i_Pos;
richedit1.SelStart:=i_Last - 1;
richedit1.SelLength:=StrLen;
richedit1.SelAttributes.Color:=clred;
i_Pos:=pos(FindStr,str);
delete(str,1,i_pos + StrLen - 1);
i_Last:=i_Last + StrLen - 1;
end;
end;