Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Loading