From 17525a9a7ace1c7a74091bb419dfdd41046251a9 Mon Sep 17 00:00:00 2001 From: "Alexey T." Date: Thu, 19 Dec 2024 20:34:50 +0300 Subject: [PATCH] avoid flicker with white on app startup --- atsynedit/atsynedit.pas | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/atsynedit/atsynedit.pas b/atsynedit/atsynedit.pas index 6ed391cc..dbcb84ab 100644 --- a/atsynedit/atsynedit.pas +++ b/atsynedit/atsynedit.pas @@ -6476,8 +6476,23 @@ procedure TATSynEdit.DoContextPopup(MousePos: TPoint; var Handled: Boolean); end; procedure TATSynEdit.WMEraseBkgnd(var Msg: TLMEraseBkgnd); +var + R: TRect; begin - //needed to remove flickering on resize and mouse-over + //to avoid flickering with white on app startup + {$ifdef windows} + if Msg.DC<>0 then + begin + Brush.Color:= Colors.TextBG; + R.Left:= 0; + R.Top:= 0; + R.Width:= Width; + R.Height:= Height; + Windows.FillRect(Msg.DC, R, Brush.Reference.Handle); + end; + {$endif} + + //to remove flickering on resize and mouse-over Msg.Result:= 1; end;