From 524df06a6cf71ae765e14a75b2d40283502e4b9e Mon Sep 17 00:00:00 2001 From: William Kent Date: Sat, 30 Mar 2019 18:14:39 -0400 Subject: [PATCH] Set Control.DefaultFont to SystemFonts.MessageBoxFont This change ensures Segoe UI is used by default on Windows Vista and later, while still not breaking compatibility with Windows XP or systems compatible with it. --- src/System.Windows.Forms/src/System/Windows/Forms/Control.cs | 2 +- .../tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs | 2 +- .../UnitTests/System/Windows/Forms/DataGridViewRowTests.cs | 2 +- .../tests/UnitTests/System/Windows/Forms/ListBoxTests.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs index 3b7bdb5160c..20e389d9a8d 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Control.cs @@ -2274,7 +2274,7 @@ public static Font DefaultFont { if (defaultFont == null) { - defaultFont = SystemFonts.DefaultFont; + defaultFont = SystemFonts.MessageBoxFont; Debug.Assert(defaultFont != null, "defaultFont wasn't set!"); } diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs index 74cea883371..254dc4f1e43 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs @@ -375,7 +375,7 @@ public void Font_SetWithHandler_CallsFontChanged() control.FontChanged += handler; // Set different. - Font font1 = SystemFonts.MenuFont; + Font font1 = new Font("Arial", 8.25f); control.Font = font1; Assert.Same(font1, control.Font); Assert.Equal(1, callCount); diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewRowTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewRowTests.cs index 366bf1216a4..7debec4462a 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewRowTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewRowTests.cs @@ -948,7 +948,7 @@ public static IEnumerable Height_NeedsHeightInfo_TestData() ColumnCount = 1, AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells }, - 22, 0, 22 + 25, 0, 25 }; yield return new object[] { new DataGridView { ColumnCount = 1, VirtualMode = true }, 6, 1, 5 }; diff --git a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListBoxTests.cs b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListBoxTests.cs index 185cadf17bb..6a1388150dd 100644 --- a/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListBoxTests.cs +++ b/src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListBoxTests.cs @@ -376,7 +376,7 @@ public void Font_SetWithHandler_CallsFontChanged() control.FontChanged += handler; // Set different. - Font font1 = SystemFonts.MenuFont; + Font font1 = new Font("Arial", 8.25f); control.Font = font1; Assert.Same(font1, control.Font); Assert.Equal(1, callCount);