RRUZ / blog

Source code for the posts of my blog https://theroadtodelphi.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Great but for TRichEdit

limelect opened this issue · comments

How to change for richedit?

  Form1.Rich1.SelAttributes.Color := clRed;
  Form1.Rich1.SelAttributes.Style := [fsBold];

I tried

TRichEdit= Class (Vcl.ComCtrls.TRichEdit);

TRichEditStyleHookColor = class(TRichEditStyleHook)
private
procedure UpdateColors;
protected
procedure WndProc(var Message: TMessage); override;
public
constructor Create(AControl: TWinControl); override;
end;

if Control.Enabled then
begin
Brush.Color := TWinControlH(Control).Color;
SelAttributes.Color:=TWinControlH(Control).Color;<<< dose not work
FontColor := TWinControlH(Control).Font.Color;

commented

@limelect
Instead using
...
TRichEditStyleHookColor = class(TRichEditStyleHook)
...

use:
...
TRichEditStyleHookColor = class(TScrollingStyleHook)
...