Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContextMenuStrip show on wrong monitor #11289

Open
osexpert opened this issue Apr 28, 2024 · 6 comments
Open

ContextMenuStrip show on wrong monitor #11289

osexpert opened this issue Apr 28, 2024 · 6 comments
Labels
area-HDPI HDPI, not specific to Dpi mode of app 🪲 bug Product bug (most likely) help wanted Good issue for external contributors Priority:3 Work that is nice to have tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework
Milestone

Comments

@osexpert
Copy link

.NET version

dotnet8

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

No idea. I had to switch to ContextMenuStrip because ContextMenu was removed in dotnet6. It may never have worked correctly.

Issue description

In dotnet 8, create a new WinForms project. Add a ContextMenuStrip on the Form.
In the Form mouse click event, do this:
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
contextMenuStrip1.Show(this, e.Location);
}
Use 2 monitors.
Run app, maximize app\form on first (left) monitor.
Click on form close to the right edge of first (left) monitor.
Notice the context menu is showing on the second (right) monitor.
This is not very user friendly! Also, ContextMenu that was removed in WinForms for dotnet6 did not have this problem.

Steps to reproduce

Info in Issue description

@osexpert osexpert added the untriaged The team needs to look at this issue in the next triage label Apr 28, 2024
@osexpert
Copy link
Author

Seems to be a known problem for over 9 years: https://stackoverflow.com/questions/26587843/prevent-toolstripmenuitems-from-jumping-to-second-screen/78399012#78399012
I wish you did not remove ContextMenu when the alternative is given so little TLC.

@elachlan
Copy link
Contributor

@Olina-Zhang can your team please test this?

@osexpert are both the monitors at normal DPI?

@Philip-Wang01
Copy link
Contributor

@elachlan Here are the test results:

  1. This is not a regression issue, it can be reproduced in .NET framework and .NET 6.0 - 9.0.
  2. The ContextMenu control does not reproduce the issue.
  3. This issue only reproduces when the DPI of the primary screen is less than or equal to the DPI of the secondary screen. The issue does not reproduce when the primary screen DPI is greater than the secondary screen DPI.
  4. Using PerMonitorV2 mode does not solve the problem.
test11289.mp4

@elachlan
Copy link
Contributor

Fantastic analysis! Thanks!

@elachlan elachlan added 🪲 bug Product bug (most likely) tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework area-HDPI HDPI, not specific to Dpi mode of app labels Apr 29, 2024
@merriemcgaw
Copy link
Member

This is not a regression, and it doesn't meet the bar for the team to address in .NET 9 given current priorities. We, of course, wouldn't say no to a community contribution that addresses the issue!

@merriemcgaw merriemcgaw added this to the Future milestone Apr 30, 2024
@merriemcgaw merriemcgaw added the Priority:3 Work that is nice to have label Apr 30, 2024
@Tanya-Solyanik Tanya-Solyanik removed the untriaged The team needs to look at this issue in the next triage label Apr 30, 2024
@elachlan elachlan added the help wanted Good issue for external contributors label May 3, 2024
Copy link
Contributor

This issue is now marked as "help wanted", and we’re looking for a community volunteer to work on this issue. If we receive no interest in 180 days, we will close the issue. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@dotnet-policy-service dotnet-policy-service bot modified the milestones: Future, Help wanted May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-HDPI HDPI, not specific to Dpi mode of app 🪲 bug Product bug (most likely) help wanted Good issue for external contributors Priority:3 Work that is nice to have tenet-compatibility Incompatibility with previous versions or with WinForms for .NET Framework
Projects
None yet
Development

No branches or pull requests

5 participants