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 ?
Change underlined ‘red’ words in (underlined) ‘fuchsia’ word
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
That are hyperlinks (in another way you do – they run fine).Sergey Tkachenko wrote:Do you need to implement it as an editing operation (that can be undone by user)?
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 …)
-
- Site Admin
- Posts: 17565
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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;
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;
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;