You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#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.
260
262
261
263
CreateParamscp=base.CreateParams;
264
+
262
265
if(!OwnerDraw)
263
266
{
264
267
// WS_EX_RIGHT overrides the BS_XXXX alignment styles
Copy file name to clipboardExpand all lines: src/System.Windows.Forms/System/Windows/Forms/Controls/TextBox/TextBoxBase.cs
+28-5Lines changed: 28 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -269,6 +269,7 @@ public override bool AutoSize
269
269
}
270
270
}
271
271
272
+
#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.
272
273
/// <summary>
273
274
/// Gets or sets the background color of the control.
274
275
/// </summary>
@@ -283,17 +284,22 @@ public override Color BackColor
283
284
{
284
285
returnbase.BackColor;
285
286
}
286
-
elseif(ReadOnly)
287
-
{
288
-
returnSystemColors.Control;
289
-
}
290
287
else
291
288
{
292
-
returnSystemColors.Window;
289
+
returnReadOnly
290
+
291
+
// If we're ReadOnly and in DarkMode, we are using a different background color.
292
+
?Application.IsDarkModeEnabled
293
+
&&GetStyle(ControlStyles.ApplyThemingImplicitly)
294
+
?SystemColors.ControlLight
295
+
:SystemColors.Control
296
+
:SystemColors.Window;
293
297
}
294
298
}
299
+
295
300
set=>base.BackColor=value;
296
301
}
302
+
#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.
#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.
#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.
0 commit comments