Skip to content
Draft
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
11 changes: 9 additions & 2 deletions src/Modern.Forms/MenuDropDown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ protected override void LayoutItems ()
width = sizes.Select (s => s.Width).Max ();
height = sizes.Select (s => s.Height).Sum () + 2;

var client_rect = new Rectangle (1, 1, width - 2, height - 2);
// Use the actual control's scaled dimensions if they are larger, to account
// for fractional DPI rounding that may produce a slightly larger buffer.
var layout_width = Math.Max (width, ScaledSize.Width);
var layout_height = Math.Max (height, ScaledSize.Height);

var client_rect = new Rectangle (1, 1, layout_width - 2, layout_height - 2);

StackLayoutEngine.VerticalExpand.Layout (client_rect, Items.Cast<ILayoutable> ());
}
Expand Down Expand Up @@ -140,7 +145,9 @@ public virtual void Show (Control parent, Point location)
}

LayoutItems ();
popup.Size = ScaleSize (new Size (width, height), 1 / (float)Scaling, 1 / (float)Scaling);
popup.Size = new Size (
(int)Math.Ceiling (width / Scaling),
(int)Math.Ceiling (height / Scaling));

Invalidate ();
popup.Show (location);
Expand Down
Loading