diff --git a/lcl/interfaces/customdrawn/customdrawndefines.inc b/lcl/interfaces/customdrawn/customdrawndefines.inc index 9876a9269f..b91761f42b 100644 --- a/lcl/interfaces/customdrawn/customdrawndefines.inc +++ b/lcl/interfaces/customdrawn/customdrawndefines.inc @@ -66,7 +66,7 @@ // ================== // Debug options // ================== -{.$define VerboseCDPaintProfiler} +{$define VerboseCDPaintProfiler} {.$define Verbose_CD_X11_Timer} {.$define CD_Debug_TTF} {.$define VerboseCDDrawing} diff --git a/lcl/interfaces/customdrawn/customdrawnproc.pas b/lcl/interfaces/customdrawn/customdrawnproc.pas index 034d67e479..4961812705 100644 --- a/lcl/interfaces/customdrawn/customdrawnproc.pas +++ b/lcl/interfaces/customdrawn/customdrawnproc.pas @@ -584,12 +584,14 @@ begin // then we need to force drawing the background to erase old contents of the buffer // // Consider also if the user wants to manually disable the background drawing - lDrawControl := True; + lDrawControl := lWindowHandle.IsControlBackgroundVisible() or (AForm.Height < AImage.Height); if Assigned(CDWidgetset.DisableFormBackgroundDrawingProc) then - lDrawControl := not CDWidgetset.DisableFormBackgroundDrawingProc(AForm); - if lDrawControl then - lDrawControl := lWindowHandle.IsControlBackgroundVisible() or (AForm.Height < AImage.Height); - if lDrawControl then + begin + if not CDWidgetset.DisableFormBackgroundDrawingProc(AForm) then + if lDrawControl then + DrawFormBackground(AImage, ACanvas); + end + else if lDrawControl then DrawFormBackground(AImage, ACanvas); // Consider the form scrolling