From 8e8771651be2709dc3f3593b0cf6bd24f1c0b2ef Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 7 Dec 2011 14:27:36 +0000 Subject: [PATCH] customdrawnws: Adds background drawing for TPanel git-svn-id: trunk@34026 - --- lcl/interfaces/customdrawn/customdrawnproc.pas | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/customdrawn/customdrawnproc.pas b/lcl/interfaces/customdrawn/customdrawnproc.pas index 815787f2fd..1a3b7da63c 100644 --- a/lcl/interfaces/customdrawn/customdrawnproc.pas +++ b/lcl/interfaces/customdrawn/customdrawnproc.pas @@ -12,7 +12,7 @@ uses IntfGraphics, lazcanvas, lazregions, // LCL GraphType, Controls, LCLMessageGlue, WSControls, LCLType, LCLProc, - Forms, Graphics, customdrawncontrols; + StdCtrls, ExtCtrls, Forms, Graphics, customdrawncontrols; type TUpdateLazImageFormat = ( @@ -309,10 +309,21 @@ begin ACanvas.SaveState; ACanvas.ResetCanvasState; + // Special drawing for some native controls + if lWinControl is TCustomPanel then + begin + // Erase the background of TPanel controls, since it can draw it's own border, but fails to draw it's own background + ACanvas.Brush.FPColor := TColorToFPColor((lWinControl as TCustomPanel).GetRGBColorResolvingParent()); + ACanvas.Pen.FPColor := ACanvas.Brush.FPColor; + ACanvas.Rectangle(Bounds(0, 0, lWinControl.Width, lWinControl.Height)); + ACanvas.ResetCanvasState; + end; + + // Send the drawing message {$ifdef VerboseCDWinControl} DebugLn(Format('[RenderChildWinControls] i=%d before LCLSendPaintMsg', [i])); {$endif} - LCLSendPaintMsg(lCDWinControl.WinControl, struct.hdc, @struct); + LCLSendPaintMsg(lWinControl, struct.hdc, @struct); // Now Draw all sub-controls if lCDWinControl.Children <> nil then