Page 1 of 1
Change underlined ‘red’ words in (underlined) ‘fuchsia’ word
Posted: Thu Oct 18, 2007 2:49 pm
by j&b
Hello,
In a TDBRichViewEdit I have several (different) words, which are underlined and red. After clicking a button I want to change their font.color in fuchsia (underlining remains).
Can someone help me ?
Posted: Thu Oct 18, 2007 4:45 pm
by Sergey Tkachenko
Do you need to implement it as an editing operation (that can be undone by user)?
Posted: Thu Oct 18, 2007 5:03 pm
by j&b
Sergey Tkachenko wrote:Do you need to implement it as an editing operation (that can be undone by user)?
That are hyperlinks (in another way you do – they run fine).
In my TDBRichView-memos I have underlined URLs with font.color:= 3252790 (green).
But all hyperlinks (for URLs) e.g. in word are blue (and underlined).
I thought I do so too. But in the meantime I have created many hyperlinks (URL) in green.
Now I want to change them in blue (without searching them -> about a menuItem).
By the way hyperlinks which call up a program (with parameters) are underlined too, but in another font.color. These hyperlinks (and jumps) are administered in a TMemo (without problems, in an easy way to change …)
Posted: Fri Oct 19, 2007 4:50 am
by Sergey Tkachenko
If you want to change color of all hyperlinks (without necessity to undo it), use this code
Code: Select all
// assuming DBRichViewEdit1.Style = RVStyle1
if DBRichViewEdit1.CanChange then begin
for i := 0 to RVStyle1.TextStyles.Count-1 do
if RVStyle1.TextStyles[i].Jump and (RVStyle1.TextStyles[i].Color = OldColor) then
RVStyle1.TextStyles[i].Color = NewColor;
DBRichViewEdit1.Change;
DBRichViewEdit1.Invalidate;
end;
Posted: Fri Oct 19, 2007 6:49 am
by j&b
Hello Sergey,
thank you for your help.
I only have to change 'RVStyle1.TextStyles.Jump' into '(fsUnderline in rvs.TextStyles.style)'.
procedure TForm1.sbTesten1Click(Sender: TObject);
var i: integer;
begin
if memo.CanChange then begin // assuming DBRichViewEdit1.Style = RVStyle1
for i := 0 to rvs.TextStyles.Count-1 do
if (fsUnderline in rvs.TextStyles.style) and (rvs.TextStyles.Color = clFuchsia) then
rvs.TextStyles.Color:= clRed;
memo.Change;
memo.Invalidate;
end;
end;