Open
Description
Description
Hello.
We have an application with custom string rendering using the DrawString method and the Segoe UI font.
After installing the KB5058499 update for Windows 11, our application began to render the string with hot prefixes incorrectly.
The DrawText method works correctly.
This issue does not exist for all fonts.
Original string: "ファイル(&F)"
Reproduction Steps
- Create a WinForms application for .Net Framework or .Net
- Override the OnPaint method of the main form:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
var text = "ファイル(&F)";
var stringFormat = new StringFormat
{
HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show
};
using (var font = new Font("Segoe UI", 10))
{
e.Graphics.DrawString($"DrawString {text}", font, SystemBrushes.ControlText, new Point(Bounds.Width / 2, Bounds.Height / 2), stringFormat);
TextRenderer.DrawText(e.Graphics, $"DrawText {text}", font, new Point(Bounds.Width / 2, Bounds.Height / 2 + 30), SystemColors.ControlText);
}
}
- Run application.
Expected behavior
The DrawString method renders a hot prefix as the DrawText method.
Actual behavior
The DrawString method does not display hot prefix correctly.
Regression?
Yes, the DrawStrings works correctly with Windows 10 and Windows 11 before KB5058499.
Known Workarounds
Not all fonts are drawn with an issue, you can select a new application font.
Configuration
.Net Framework 4.8
.Net 8
Windows 11 Pro 24H2 26100.4202
Other information
No response