Skip to content

Commit eb5affa

Browse files
Address review feedback.
Fix merge issue.
1 parent b16ca39 commit eb5affa

File tree

7 files changed

+37
-77
lines changed

7 files changed

+37
-77
lines changed

src/System.Windows.Forms/PublicAPI.Shipped.txt

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,4 @@
11
#nullable enable
2-
[WFO5001]static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void
3-
[WFO5001]System.Windows.Forms.ControlStyles.ApplyThemingImplicitly = 524288 -> System.Windows.Forms.ControlStyles
4-
[WFO5001]System.Windows.Forms.Form.FormBorderColorChanged -> System.EventHandler?
5-
[WFO5001]System.Windows.Forms.Form.FormCaptionBackColorChanged -> System.EventHandler?
6-
[WFO5001]System.Windows.Forms.Form.FormCaptionTextColorChanged -> System.EventHandler?
7-
[WFO5001]System.Windows.Forms.Form.FormCornerPreferenceChanged -> System.EventHandler?
8-
[WFO5001]System.Windows.Forms.FormCornerPreference
9-
[WFO5001]System.Windows.Forms.FormCornerPreference.Default = 0 -> System.Windows.Forms.FormCornerPreference
10-
[WFO5001]System.Windows.Forms.FormCornerPreference.DoNotRound = 1 -> System.Windows.Forms.FormCornerPreference
11-
[WFO5001]System.Windows.Forms.FormCornerPreference.Round = 2 -> System.Windows.Forms.FormCornerPreference
12-
[WFO5001]System.Windows.Forms.FormCornerPreference.RoundSmall = 3 -> System.Windows.Forms.FormCornerPreference
13-
[WFO5001]System.Windows.Forms.SystemColorMode
14-
[WFO5001]System.Windows.Forms.SystemColorMode.Classic = 0 -> System.Windows.Forms.SystemColorMode
15-
[WFO5001]System.Windows.Forms.SystemColorMode.Dark = 2 -> System.Windows.Forms.SystemColorMode
16-
[WFO5001]System.Windows.Forms.SystemColorMode.System = 1 -> System.Windows.Forms.SystemColorMode
17-
[WFO5001]virtual System.Windows.Forms.Form.OnFormBorderColorChanged(System.EventArgs! e) -> void
18-
[WFO5001]virtual System.Windows.Forms.Form.OnFormCaptionBackColorChanged(System.EventArgs! e) -> void
19-
[WFO5001]virtual System.Windows.Forms.Form.OnFormCaptionTextColorChanged(System.EventArgs! e) -> void
20-
[WFO5001]virtual System.Windows.Forms.Form.OnFormCornerPreferenceChanged(System.EventArgs! e) -> void
21-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
22-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
23-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
24-
[WFO5002]System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task!
25-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
26-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
27-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
28-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
29-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
30-
[WFO5002]System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task!
31-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
32-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
33-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
34-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
35-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
36-
[WFO5002]System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task!
37-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
38-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
39-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
40-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
41-
[WFO5002]static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
42-
[WFO5002]System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task!
43-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
44-
[WFO5002]System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
452
[WFO5003]System.Windows.Forms.IAsyncDropTarget
463
[WFO5003]System.Windows.Forms.IAsyncDropTarget.OnAsyncDragDrop(System.Windows.Forms.DragEventArgs! e) -> void
474
~abstract System.Windows.Forms.DataGridColumnStyle.Commit(System.Windows.Forms.CurrencyManager dataSource, int rowNum) -> bool
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1+
static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void
12
static System.Windows.Forms.TaskDialog.ShowDialogAsync(nint hwndOwner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
23
static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner, System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterOwner) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
34
static System.Windows.Forms.TaskDialog.ShowDialogAsync(System.Windows.Forms.TaskDialogPage! page, System.Windows.Forms.TaskDialogStartupLocation startupLocation = System.Windows.Forms.TaskDialogStartupLocation.CenterScreen) -> System.Threading.Tasks.Task<System.Windows.Forms.TaskDialogButton!>!
4-
System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task!
5-
System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
6-
System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
7-
System.Windows.Forms.VisualStyles.ComboBoxState.Focused = 5 -> System.Windows.Forms.VisualStyles.ComboBoxState
8-
static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void
95
System.Windows.Forms.ControlStyles.ApplyThemingImplicitly = 524288 -> System.Windows.Forms.ControlStyles
106
System.Windows.Forms.Form.FormBorderColorChanged -> System.EventHandler?
117
System.Windows.Forms.Form.FormCaptionBackColorChanged -> System.EventHandler?
128
System.Windows.Forms.Form.FormCaptionTextColorChanged -> System.EventHandler?
139
System.Windows.Forms.Form.FormCornerPreferenceChanged -> System.EventHandler?
10+
System.Windows.Forms.Form.ShowAsync(System.Windows.Forms.IWin32Window? owner = null) -> System.Threading.Tasks.Task!
11+
System.Windows.Forms.Form.ShowDialogAsync() -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
12+
System.Windows.Forms.Form.ShowDialogAsync(System.Windows.Forms.IWin32Window! owner) -> System.Threading.Tasks.Task<System.Windows.Forms.DialogResult>!
1413
System.Windows.Forms.FormCornerPreference
1514
System.Windows.Forms.FormCornerPreference.Default = 0 -> System.Windows.Forms.FormCornerPreference
1615
System.Windows.Forms.FormCornerPreference.DoNotRound = 1 -> System.Windows.Forms.FormCornerPreference
@@ -20,8 +19,8 @@ System.Windows.Forms.SystemColorMode
2019
System.Windows.Forms.SystemColorMode.Classic = 0 -> System.Windows.Forms.SystemColorMode
2120
System.Windows.Forms.SystemColorMode.Dark = 2 -> System.Windows.Forms.SystemColorMode
2221
System.Windows.Forms.SystemColorMode.System = 1 -> System.Windows.Forms.SystemColorMode
22+
System.Windows.Forms.VisualStyles.ComboBoxState.Focused = 5 -> System.Windows.Forms.VisualStyles.ComboBoxState
2323
virtual System.Windows.Forms.Form.OnFormBorderColorChanged(System.EventArgs! e) -> void
2424
virtual System.Windows.Forms.Form.OnFormCaptionBackColorChanged(System.EventArgs! e) -> void
2525
virtual System.Windows.Forms.Form.OnFormCaptionTextColorChanged(System.EventArgs! e) -> void
26-
virtual System.Windows.Forms.Form.OnFormCornerPreferenceChanged(System.EventArgs! e) -> void
27-
System.Windows.Forms.VisualStyles.ComboBoxState.Focused = 5 -> System.Windows.Forms.VisualStyles.ComboBoxState
26+
virtual System.Windows.Forms.Form.OnFormCornerPreferenceChanged(System.EventArgs! e) -> void

src/System.Windows.Forms/System/Windows/Forms/Application.cs

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ namespace System.Windows.Forms;
2121
public sealed partial class Application
2222
{
2323
/// <summary>
24-
/// Hash table for our event list
24+
/// Hash table for our event list.
2525
/// </summary>
2626
private static EventHandlerList? s_eventHandlers;
2727
private static Font? s_defaultFont;
2828
/// <summary>
29-
/// Scaled version of non system <see cref="s_defaultFont"/>.
29+
/// Scaled version of non-system <see cref="s_defaultFont"/>.
3030
/// </summary>
3131
private static Font? s_defaultFontScaled;
3232
private static string? s_startupPath;
@@ -50,7 +50,7 @@ public sealed partial class Application
5050
private const int SystemDarkModeDisabled = 1;
5151

5252
/// <summary>
53-
/// Events the user can hook into
53+
/// Events the user can hook into.
5454
/// </summary>
5555
private static readonly object s_eventApplicationExit = new();
5656
private static readonly object s_eventThreadExit = new();
@@ -65,16 +65,16 @@ public sealed partial class Application
6565
private static bool s_parkingWindowCreated;
6666

6767
/// <summary>
68-
/// This class is static, there is no need to ever create it.
68+
/// This class is static; there is no need to ever create it.
6969
/// </summary>
7070
private Application()
7171
{
7272
}
7373

7474
/// <summary>
7575
/// Determines if the caller should be allowed to quit the application. This will return false,
76-
/// for example, if being called from a windows forms control being hosted within a web browser. The
77-
/// windows forms control should not attempt to quit the application.
76+
/// for example, if being called from a Windows Forms control being hosted within a web browser. The
77+
/// Windows Forms control should not attempt to quit the application.
7878
/// </summary>
7979
public static bool AllowQuit => ThreadContext.GetAllowQuit();
8080

@@ -271,8 +271,8 @@ internal static bool CustomThreadExceptionHandlerAttached
271271
/// to apply the new system setting.
272272
/// </para>
273273
/// <para>
274-
/// Note that Dark Mode is only available on Windows 11 and later. If Windows is set to High Contrast mode,
275-
/// that mode always takes precedence over other settings.
274+
/// Note that the dark color mode is only available from Windows 11 on or later versions. If the system
275+
/// is set to a accessibility contrast theme, the dark mode is not available.
276276
/// </para>
277277
/// <para>
278278
/// <b>Note for Visual Basic:</b> If you are using the Visual Basic Application Framework, set the color mode
@@ -389,14 +389,15 @@ static void NotifySystemEventsOfColorChange()
389389
/// <remarks>
390390
/// <para>
391391
/// The color setting is determined based on the operating system version and its system settings.
392-
/// It returns <see cref="SystemColorMode.Dark"/> if the dark mode is enabled in the system settings,
393-
/// <see cref="SystemColorMode.Classic"/> if the color mode equals the light, standard color setting.
392+
/// It returns <see cref="SystemColorMode.Dark"/> if dark mode is enabled in the system settings,
393+
/// or <see cref="SystemColorMode.Classic"/> if the color mode is set to the light, standard color setting.
394394
/// </para>
395395
/// <para>
396-
/// SystemColorMode is supported on Windows 11 or later versions.
396+
/// <see cref="SystemColorMode"/> is supported on Windows 11 or later versions.
397397
/// </para>
398398
/// <para>
399-
/// SystemColorModes is not supported, if the Windows OS <c>High Contrast Mode</c> has been enabled in the system settings.
399+
/// <see cref="SystemColorMode"/> is not supported if a Windows OS high contrast theme has been
400+
/// enabled in the system settings.
400401
/// </para>
401402
/// </remarks>
402403
public static SystemColorMode SystemColorMode =>
@@ -434,7 +435,7 @@ private static int GetSystemColorModeInternal()
434435

435436
/// <summary>
436437
/// Gets a value indicating whether the application is running in a dark system color context.
437-
/// Note: In a high contrast mode, this will always return <see langword="false"/>.
438+
/// Note: With a accessibility contrast theme selected in the OS, this will always return <see langword="false"/>.
438439
/// </summary>
439440
public static bool IsDarkModeEnabled =>
440441
!SystemInformation.HighContrast
@@ -949,7 +950,7 @@ internal static void DoEventsModal()
949950

950951
/// <summary>
951952
/// Enables visual styles for all subsequent <see cref="Run()"/> and <see cref="Control.CreateHandle"/> calls.
952-
/// Uses the default theming manifest file shipped with the redist.
953+
/// Uses the default theming manifest file shipped with the redistributable package.
953954
/// </summary>
954955
[UnconditionalSuppressMessage("SingleFile", "IL3002", Justification = "Single-file case is handled")]
955956
public static void EnableVisualStyles()
@@ -1363,6 +1364,10 @@ internal static void RunDialog(Form form)
13631364
/// This switch determines the default text rendering engine to use by some controls that support
13641365
/// switching rendering engine.
13651366
/// </summary>
1367+
/// <param name="defaultValue">The default value to use for compatible text rendering.</param>
1368+
/// <exception cref="InvalidOperationException">
1369+
/// Thrown if any window handle has already been created in the application.
1370+
/// </exception>
13661371
public static void SetCompatibleTextRenderingDefault(bool defaultValue)
13671372
{
13681373
if (NativeWindow.AnyHandleCreated)
@@ -1374,7 +1379,7 @@ public static void SetCompatibleTextRenderingDefault(bool defaultValue)
13741379
}
13751380

13761381
/// <summary>
1377-
/// Sets the default <see cref="Font"/> for process.
1382+
/// Sets the default <see cref="Font"/> for the process.
13781383
/// </summary>
13791384
/// <param name="font">The font to be used as a default across the application.</param>
13801385
/// <exception cref="ArgumentNullException"><paramref name="font"/> is <see langword="null"/>.</exception>
@@ -1383,11 +1388,11 @@ public static void SetCompatibleTextRenderingDefault(bool defaultValue)
13831388
/// </exception>
13841389
/// <remarks>
13851390
/// <para>
1386-
/// The system text scale factor will be applied to the font, i.e. if the default font is set to "Calibri, 11f"
1387-
/// and the text scale factor is set to 150% the resulting default font will be set to "Calibri, 16.5f".
1391+
/// The system text scale factor will be applied to the font. For example, if the default font is set to "Calibri, 11f"
1392+
/// and the text scale factor is set to 150%, the resulting default font will be set to "Calibri, 16.5f".
13881393
/// </para>
13891394
/// <para>
1390-
/// Users can adjust text scale with the Make text bigger slider on the Settings -> Ease of Access -> Vision/Display screen.
1395+
/// Users can adjust text scale with the "Make text bigger" slider on the Settings → Accessibility → Display screen.
13911396
/// </para>
13921397
/// </remarks>
13931398
/// <seealso href="https://docs.microsoft.com/windows/uwp/design/input/text-scaling">Windows Text scaling</seealso>
@@ -1403,7 +1408,7 @@ public static void SetDefaultFont(Font font)
14031408
}
14041409

14051410
/// <summary>
1406-
/// Scale <see cref="s_defaultFont"/> or <see cref="s_defaultFontScaled"/> if needed.
1411+
/// Scales <see cref="s_defaultFont"/> or <see cref="s_defaultFontScaled"/> if needed.
14071412
/// </summary>
14081413
internal static void ScaleDefaultFont()
14091414
{

src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/ButtonInternal/RadioButtonBaseAdapter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ protected void DrawCheckBackgroundFlat(PaintEventArgs e, Rectangle bounds, Color
6262

6363
if (!Control.Enabled)
6464
{
65-
// If we are not in HighContrast mode OR we opted into the legacy behavior
65+
// If we are not in contrast theme OR we opted into the legacy behavior
6666
if (!SystemInformation.HighContrast)
6767
{
6868
border = ControlPaint.ContrastControlDark;
6969
}
7070

71-
// Otherwise we are in HighContrast mode
71+
// Otherwise we are in a contrast theme
7272
field = SystemColors.Control;
7373
}
7474

src/System.Windows.Forms/System/Windows/Forms/Controls/PropertyGrid/PropertyGridInternal/CategoryGridEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public override void PaintLabel(
121121
Rectangle focusRect = new(indent, rect.Y, labelWidth + 3, rect.Height - 1);
122122
if (SystemInformation.HighContrast && !OwnerGrid.HasCustomLineColor)
123123
{
124-
// Line color is SystemColors.ControlDarkDark in high contrast mode.
124+
// Line color is SystemColors.ControlDarkDark in a contrast theme scenario.
125125
ControlPaint.DrawFocusRectangle(g, focusRect, SystemColors.ControlText, OwnerGrid.LineColor);
126126
}
127127
else

0 commit comments

Comments
 (0)