diff --git a/GUI/Controls/ThemedTabControl.cs b/GUI/Controls/ThemedTabControl.cs index 13dcd7946e..d0f6f54317 100644 --- a/GUI/Controls/ThemedTabControl.cs +++ b/GUI/Controls/ThemedTabControl.cs @@ -21,7 +21,10 @@ protected override void OnDrawItem(DrawItemEventArgs e) Rectangle bgRect = e.Bounds; bgRect.Inflate(-2, -1); bgRect.Offset(0, 1); - e.Graphics.FillRectangle(new SolidBrush(BackColor), bgRect); + using (SolidBrush bgBrush = new SolidBrush(BackColor)) + { + e.Graphics.FillRectangle(bgBrush, bgRect); + } // e.Index can be invalid (!!), so we need try/catch try {