我想做一个上下文比较的功能,界面上有两个RichEdit 只有在下边的可以输入,与上边的RichEdit 作对照输入一个字母对应一个字母,但是需要输入过程中把输入错误的用红色标出来,这样的功能怎样实现,主要的问题是 RichEdit 只有选中的可以改变颜色,不选中的不能改变,虽然设置了SelAttributes 但是这时事前设置,我是需要输入之后根据输入的正确与否改变颜色,这个怎么实现
解决方案 »
- Delphi Program 如何动态更新 WebService IP Address
- delphi程序窗体和控件 如何适应1440x900分辨率?
- 1、DbGridEh如何使某一列不能得到焦点;2、DbGridEh某一Cell中,数字的位数,得到焦点的时候非常长,如何让它得到焦点时只显示两位?
- Delphi7+ADO+access2003的问题?
- 如何在Form上加一个垂直滚动条?
- ???delphi7.0装在winn2000server上为何找不到Qreport面版???
- 如何实现,程序一启动,plane自动停靠在Form上,并出现拖动的竖条 100分!!
- 求delphi加密java解密的源码
- 请问如何将报表控件preview生成窗体中的英文提示换成中文
- 怎样判断注册表中是否存在某个值?
- 求抽奖程序源代码或算法(dephi版)
- 简单问题
var
S: WideString;
T: WideString;
I: Integer;
begin
RichEdit1.HideSelection := True;
RichEdit1.Lines.BeginUpdate;
RichEdit1.SelectAll;
RichEdit1.SelAttributes.Color := clWindowText;
RichEdit1.SelAttributes.Style := [];
S := RichEdit1.Text;
T := TEdit(Sender).Text;
for I := 1 to Min(Length(T), Length(S)) do
begin
RichEdit1.SelStart := Length(string(Copy(S, 1, I - 1)));
RichEdit1.SelLength := Length(S[I]);
if T[I] = S[I] then
RichEdit1.SelAttributes.Color := clGreen
else
begin
RichEdit1.SelAttributes.Color := clRed;
RichEdit1.SelAttributes.Style := [fsUnderline];
end;
end;
RichEdit1.Lines.EndUpdate;
end;