阿 阿权 Unregistered / Unconfirmed GUEST, unregistred user! 1998-12-16 #1 我要修改任意一行内容的颜色、字体,如何设置SelStart、Sellength?
D dwwang Unregistered / Unconfirmed GUEST, unregistred user! 1998-12-16 #2 我想可以这样: with richedit1 do begin plaintext:=false; FoundAt := richedit1.FindText(lines[3],0,Length(Text),[]); if (FoundAt <> 0) then begin SelStart := FoundAt; SelLength := Length(lines[3]); SelAttributes.Size:=16; end; end;
我想可以这样: with richedit1 do begin plaintext:=false; FoundAt := richedit1.FindText(lines[3],0,Length(Text),[]); if (FoundAt <> 0) then begin SelStart := FoundAt; SelLength := Length(lines[3]); SelAttributes.Size:=16; end; end;
D dwwang Unregistered / Unconfirmed GUEST, unregistred user! 1998-12-16 #4 我上面介绍的不过是一种解决办法,如果想确认修改第几行, 用个循环把之前的各行的长度加起来(+1),从而确定 本行的起始位置也是可以的吧! ^_^
P pegasus Unregistered / Unconfirmed GUEST, unregistred user! 1998-12-16 #5 Hehe, you can find the Line Feed or Carriage Return chars, i.e. LF, CR, etc,
C cHengyAng Unregistered / Unconfirmed GUEST, unregistred user! 1998-12-16 #6 With Richedit do if SelLength<>0 then StartPos:=SelStart+SelLength else StartPos:=0; ToEnd:=Length(text)-FindStart; FoundAt := FindText(YourText,StartPos,Toend,[stWholeWord]); if FoundAt<>-1 then ...... end;
With Richedit do if SelLength<>0 then StartPos:=SelStart+SelLength else StartPos:=0; ToEnd:=Length(text)-FindStart; FoundAt := FindText(YourText,StartPos,Toend,[stWholeWord]); if FoundAt<>-1 then ...... end;
3 3h Unregistered / Unconfirmed GUEST, unregistred user! 1999-06-01 #7 因为问题的提出者已经很久未到,就结束答案吧。 cHengyAng & dwwang的答案应该都是可行的,每人一半。 -- by 3h