Fix fractional DPI drawing issues with popup menus#104
Draft
Conversation
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>
Copilot
AI
changed the title
[WIP] Fix fractional resolution drawing issues with popup menus
Fix fractional DPI drawing issues with popup menus
Mar 28, 2026
Collaborator
|
@copilot This did not seem to fix any of the issues, updated screenshot attached.
|
Copilot stopped work on behalf of
jpobst due to an error
March 28, 2026 22:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

At fractional DPI scales (e.g. 150%), popup menu borders have missing corners and selected item backgrounds show extra pixel gaps. Root cause: the device→logical→device pixel round-trip in
MenuDropDown.Show()usesMath.Round, which can shrink the rendering buffer by 1px, clipping border lines and misaligning item fills.Show(): UseMath.Ceilinginstead ofMath.Roundwhen converting device pixel dimensions to logical pixels for the popup size, ensuring the buffer is never smaller than the calculated menu dimensionsLayoutItems(): UseMath.Max(calculated, ScaledSize)so items expand to fill any extra pixels introduced by ceiling rounding, preventing background-color gaps between items and borders✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.