Skip to content

Commit 14655b2

Browse files
author
errorsoft
committed
fix: TRegExEdit style hook issue
1 parent e2319b3 commit 14655b2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Source/ES.RegExControls.pas

+25
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@ TEsRegexEdit = class(TEdit, IRegexIndicator)
135135
// TEdit style hook
136136
TEsRegexEditStyleHook = class(TEditStyleHook)
137137
strict protected
138+
{$IFNDEF VER350UP}
138139
procedure PaintBackground(Canvas: TCanvas); override;
140+
{$ENDIF}
141+
{$IFDEF VER350UP}
142+
procedure WndProc(var Message: TMessage); override;
143+
{$ENDIF}
139144
end;
140145

141146
// TButtonedEdit
@@ -533,11 +538,31 @@ procedure TEsRegexEdit.SetColorInvalid(const Value: TColor);
533538

534539
{ TEsRegExEditStyleHook }
535540

541+
{$IFNDEF VER350UP}
536542
procedure TEsRegexEditStyleHook.PaintBackground(Canvas: TCanvas);
537543
begin
538544
Brush.Color := Control.Brush.Color;
539545
inherited;
540546
end;
547+
{$ENDIF}
548+
549+
{$IFDEF VER350UP}
550+
procedure TEsRegexEditStyleHook.WndProc(var Message: TMessage);
551+
begin
552+
case Message.Msg of
553+
CN_CTLCOLORMSGBOX..CN_CTLCOLORSTATIC:
554+
begin
555+
inherited WndProc(Message);
556+
Brush.Color := Control.Brush.Color;
557+
SetBkColor(Message.WParam, ColorToRGB(Brush.Color));
558+
Message.Result := LRESULT(Brush.Handle);
559+
Handled := True;
560+
end;
561+
else
562+
inherited WndProc(Message);
563+
end;
564+
end;
565+
{$ENDIF}
541566

542567
{ TEsRegExButtonedEdit }
543568

0 commit comments

Comments
 (0)