Skip to content

Commit 524df06

Browse files
committed
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.
1 parent c99df8c commit 524df06

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/System.Windows.Forms/src/System/Windows/Forms/Control.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ public static Font DefaultFont
22742274
{
22752275
if (defaultFont == null)
22762276
{
2277-
defaultFont = SystemFonts.DefaultFont;
2277+
defaultFont = SystemFonts.MessageBoxFont;
22782278
Debug.Assert(defaultFont != null, "defaultFont wasn't set!");
22792279
}
22802280

src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ComboBoxTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ public void Font_SetWithHandler_CallsFontChanged()
375375
control.FontChanged += handler;
376376

377377
// Set different.
378-
Font font1 = SystemFonts.MenuFont;
378+
Font font1 = new Font("Arial", 8.25f);
379379
control.Font = font1;
380380
Assert.Same(font1, control.Font);
381381
Assert.Equal(1, callCount);

src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/DataGridViewRowTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ public static IEnumerable<object[]> Height_NeedsHeightInfo_TestData()
948948
ColumnCount = 1,
949949
AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
950950
},
951-
22, 0, 22
951+
25, 0, 25
952952
};
953953
yield return new object[] { new DataGridView { ColumnCount = 1, VirtualMode = true }, 6, 1, 5 };
954954

src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/ListBoxTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ public void Font_SetWithHandler_CallsFontChanged()
376376
control.FontChanged += handler;
377377

378378
// Set different.
379-
Font font1 = SystemFonts.MenuFont;
379+
Font font1 = new Font("Arial", 8.25f);
380380
control.Font = font1;
381381
Assert.Same(font1, control.Font);
382382
Assert.Equal(1, callCount);

0 commit comments

Comments
 (0)