dotnet/winforms

ContextMenuStrip show on wrong monitor

Open

#11.289 geöffnet am 28. Apr. 2024

Auf GitHub ansehen
 (8 Kommentare) (1 Reaktion) (0 zugewiesene Personen)C# (922 Forks)batch import
:beetle: bugarea-HDPIhelp wantedpriority-3tenet-compatibility

Repository-Metriken

Stars
 (4.100 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 14T 22h) (56 gemergte PRs in 30 T)

Beschreibung

.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

Contributor Guide