diff --git a/lcl/interfaces/customdrawn/customdrawnwinapi.inc b/lcl/interfaces/customdrawn/customdrawnwinapi.inc index e0bfd1219a..dfe19601f5 100644 --- a/lcl/interfaces/customdrawn/customdrawnwinapi.inc +++ b/lcl/interfaces/customdrawn/customdrawnwinapi.inc @@ -1057,8 +1057,11 @@ begin if not IsValidDC(DC) then exit; + // Drawer.DrawFocusRect alters the Pen and Brush, so we save the state here + LazDC.SaveState(); GetDefaultDrawer().DrawFocusRect(LazDC, Point(Rect.Left, Rect.Top), Size(Rect.Right - Rect.Left, Rect.Bottom - Rect.Top)); + LazDC.RestoreState(-1); end; function TCDWidgetSet.DrawFrameControl(DC: HDC; const Rect: TRect; uType,