diff --git a/src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.Modern.cs b/src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.Modern.cs index 766c40d952d..a700347b0c4 100644 --- a/src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.Modern.cs +++ b/src/System.Windows.Forms/System/Windows/Forms/Controls/ComboBox/ComboBox.Modern.cs @@ -167,10 +167,8 @@ private ModernComboTargetState ComputeModernComboTargetState() int bottomInset = chromeInsets.Bottom + Padding.Bottom; editBounds.Y += topInset; - editBounds.Height = Math.Max( - 1, - editBounds.Height - topInset - bottomInset); - + // A single-line EDIT control's text visibility depends on its window height. + // Preserve the native height so glyphs are not clipped. editBounds.Height = Math.Max( 1, Math.Min( diff --git a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs index a9477200bc6..a46e2225455 100644 --- a/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs +++ b/src/test/unit/System.Windows.Forms/System/Windows/Forms/ComboBoxTests.cs @@ -795,6 +795,32 @@ public void ComboBox_ModernPadding_UpdatesHeightAndEditBounds( Assert.True(updatedEditBounds.Width < editBounds.Width); } + [WinFormsTheory] + [InlineData(ComboBoxStyle.DropDown)] + [InlineData(ComboBoxStyle.Simple)] + public void ComboBox_ModernVisualStyles_EditHeightDoesNotClipText( + ComboBoxStyle dropDownStyle) + { + using SystemVisualSettingsTestScope settingsScope = new( + clientAreaAnimationEnabled: false, + highContrastEnabled: false); + using VisualStylesComboBox control = new() + { + DropDownStyle = dropDownStyle, + FlatStyle = FlatStyle.Standard, + Size = dropDownStyle == ComboBoxStyle.Simple + ? new Size(140, 100) + : new Size(140, 40), + Text = "Text with descenders: gjpqy", + VisualStylesMode = VisualStylesMode.Net11 + }; + control.CreateControl(); + + Assert.True( + control.GetEditBounds().Height + >= control.ModernEditBaseBounds.Height); + } + [WinFormsTheory] [InlineData(ComboBoxStyle.DropDown)] [InlineData(ComboBoxStyle.Simple)]