Skip to content

Commit 13733fc

Browse files
Address review comments.
1 parent 8d9af62 commit 13733fc

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,21 +3696,22 @@ protected override unsafe void WndProc(ref Message m)
36963696
}
36973697

36983698
// Additional handling for Simple style listbox when disabled
3699-
if (DropDownStyle == ComboBoxStyle.Simple && Application.IsDarkModeEnabled && !Enabled)
3699+
if (DropDownStyle == ComboBoxStyle.Simple
3700+
&& Application.IsDarkModeEnabled
3701+
&& !Enabled
3702+
&& hwndChild == _childListBox?.HWND)
37003703
{
3701-
if (hwndChild == _childListBox?.HWND)
3702-
{
3703-
PInvokeCore.SetBkColor(
3704-
(HDC)m.WParamInternal,
3705-
ColorTranslator.ToWin32(Color.FromArgb(64, 64, 64)));
3704+
PInvokeCore.SetBkColor(
3705+
(HDC)m.WParamInternal,
3706+
ColorTranslator.ToWin32(Color.FromArgb(64, 64, 64)));
3707+
3708+
PInvokeCore.SetTextColor(
3709+
(HDC)m.WParamInternal,
3710+
ColorTranslator.ToWin32(Color.FromArgb(180, 180, 180)));
37063711

3707-
PInvokeCore.SetTextColor(
3708-
(HDC)m.WParamInternal,
3709-
ColorTranslator.ToWin32(Color.FromArgb(180, 180, 180)));
3712+
m.ResultInternal = (LRESULT)s_darkEditBrush;
37103713

3711-
m.ResultInternal = (LRESULT)s_darkEditBrush;
3712-
return;
3713-
}
3714+
return;
37143715
}
37153716
#pragma warning restore WFO5001
37163717

src/System.Windows.Forms/System/Windows/Forms/Controls/RichTextBox/RichTextBox.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,12 +3428,15 @@ protected override unsafe void WndProc(ref Message m)
34283428
{
34293429
#pragma warning disable WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
34303430
case PInvokeCore.WM_PAINT:
3431+
3432+
// Important: We need to let to run the base
3433+
// renderer first in the case of the RTF control.
3434+
base.WndProc(ref m);
3435+
34313436
if (Handle == m.HWND
34323437
&& !Enabled
34333438
&& Application.IsDarkModeEnabled)
34343439
{
3435-
base.WndProc(ref m);
3436-
34373440
// If the control is disabled, we don't want to let the RTF control
34383441
// paint anything else. We will paint the background and the unformatted
34393442
// text ourselves, so we don't want the RTF control to paint the background
@@ -3452,14 +3455,12 @@ protected override unsafe void WndProc(ref Message m)
34523455
SystemColors.GrayText,
34533456
TextFormatFlags.Left
34543457
| TextFormatFlags.Top
3455-
| TextFormatFlags.WordBreak,
3458+
| TextFormatFlags.WordBreak
34563459
| TextFormatFlags.EndEllipsis);
34573460

34583461
return;
34593462
}
34603463

3461-
base.WndProc(ref m);
3462-
34633464
break;
34643465
#pragma warning restore WFO5001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
34653466

0 commit comments

Comments
 (0)