question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dual monitor dialog resize issue

See original GitHub issue

Note: Considering my last bug report for the .NET Framework at the developer community has been migrated to the corresponding .NET Core project I report this issue directly here. Please note though that .NET Framework is also affected.

Issue reproduction steps:

  1. Make sure your secondary display is left or above of your primary display (so it has negative relative coordinates)
  2. Create a new Windows Forms Application and display a form by ShowDialog so the resize grip is visible.
  3. Execute the application and drag the form to the secondary display.
  4. Now as its coordinates are in the negative range, move the mouse along the border and see that the diagonal resize cursor appears all around the form. The issue is not just the displayed cursor but also the resizing behavior behavior: even clicking the top border the bottom-right corner will be resized

See also the screenshot below (the cursor is indicated by me).

image

Proposed fix:

The root cause lies in the Form.WmNCHitTest method. m.LParam contains two short values but the way of converting them to integers is wrong.

Original code:

// This is wrong for negative values. For example, -500 will be interpreted as 65036
int x = NativeMethods.Util.LOWORD(m.LParam);
int y = NativeMethods.Util.HIWORD(m.LParam);

Fixed code:

// LParam contains two shorts. Without the cast negative values turn positive ints
int x = (short)(m.LParam.ToInt32() & 0xFFFF);
int y = (short)((m.LParam.ToInt32() >> 16) & 0xFFFF);

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
weltkantecommented, Oct 4, 2019

@koszeggy the daily build page doesn’t mention it but if you click the link the actual download section has 5.0 daily builds

0reactions
koszeggycommented, Oct 5, 2019

I added the StatusBar fix to the PR. I didn’t change the ActiveX-related code found by @0xd4d though. Its test is a bit more complex and I think that would require another version of the MAKELPARAM method as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window resizing problem using dual monitors
- Click Start and type "resolution". - Select "Change display settings". - You should be able to modify the resolution for both monitors....
Read more >
Windows applications resized incorrectly when moving ...
When using the Windows-Shift Right/Left keys to move between screens, the application usually gets resized incorrectly where it ends up being ...
Read more >
Multi-Monitor dragging windows between screens resizes ...
When I right-click on my desktop and choose display, I see that both screens are set to 1920x1080 and I have them in...
Read more >
Adjust Window Resize to Fit Dual Monitor Problem
If a window is positioned on the secondary monitor and the the script step "Adjust Window [Resize to Fit]" is run, the window...
Read more >
Dialog window positioning is not preserved in AutoCAD ...
Issue: Dialog windows, dialog boxes, and palettes do not retain their positions or arrangement when exiting and relaunching AutoCAD products ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found