Skip to content

Commit 34d50ce

Browse files
authored
[release/8.0] Avoid Creating Graphics in TabControl.WmReflectDrawItem() (#12216)
cherry pick f4e6922
1 parent e65ea78 commit 34d50ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/System.Windows.Forms/src/System/Windows/Forms/TabControl.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,11 +1945,13 @@ private unsafe void WmReflectDrawItem(ref Message m)
19451945
DRAWITEMSTRUCT* dis = (DRAWITEMSTRUCT*)(nint)m.LParamInternal;
19461946

19471947
using DrawItemEventArgs e = new(
1948-
dis->hDC.CreateGraphics(),
1948+
dis->hDC,
19491949
Font,
19501950
dis->rcItem,
1951-
(int)dis->itemID,
1952-
(DrawItemState)(int)dis->itemState);
1951+
dis->itemID,
1952+
dis->itemState,
1953+
ForeColor,
1954+
BackColor);
19531955

19541956
OnDrawItem(e);
19551957

0 commit comments

Comments
 (0)