From 9e3a663beb244c497f8b781921374642310f81ca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 21:49:23 +0000 Subject: [PATCH 1/2] Initial plan From 814dba80e4fd58856001bb55fdf60dabdc3b7cad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Mar 2026 22:01:37 +0000 Subject: [PATCH 2/2] Fix fractional DPI drawing issues with popup menus Use Math.Ceiling instead of Math.Round when converting device pixel dimensions to logical pixels for the popup window size. This prevents the rendering buffer from being smaller than the calculated menu dimensions at fractional DPI scales (e.g. 150%). Also use the actual control's scaled dimensions in LayoutItems() to ensure menu items fill the available space, fixing extra pixel gaps. Agent-Logs-Url: https://github.com/modern-forms/Modern.Forms/sessions/b107a3d9-1ec4-4d72-8040-a1c5814d3dee Co-authored-by: jpobst <179295+jpobst@users.noreply.github.com> --- src/Modern.Forms/MenuDropDown.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Modern.Forms/MenuDropDown.cs b/src/Modern.Forms/MenuDropDown.cs index 61373dde..39dddd28 100644 --- a/src/Modern.Forms/MenuDropDown.cs +++ b/src/Modern.Forms/MenuDropDown.cs @@ -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 ()); } @@ -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);