-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
.NET version
SDK DE .NET:
Version: 7.0.202
Commit: 6c74320bc3
Entorno de tiempo de ejecución:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.202\
Host:
Version: 7.0.4
Architecture: x64
Commit: 0a396acafe
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
When a Form is opened and StartPosition is CenterParent, it is opened always on the main monitor when the value of WindowState is Maximized.
If a window is opened on the secondary monitor, instead of being displayed on that monitor it is displayed on the primary.
Because of this, we cannot open maximized forms by default on the same monitor as the parent window.
Here is a test form that demonstrates the observed behavior:
As a workaround, it is possible to set the WindowState in the overridden OnLoad method. (The "Open form that overrides onLoad normal with center parent without parent" and "Open form that overrides onLoad normal with center parent with parent" buttons in Form1). Although if the form contains many controls and takes time to load, you see a rectangle on the wrong monitor before moving to the correct one.
Steps to reproduce
Environment
2 monitor setup (1920x1080 each)
Left monitor assigned as primary monitor
Reproduction Steps:
- Run the test application
- Move application window to secondary monitor
- Click the "Open form normal with center parent" button
- Close the modal window
- Click the "Open form maximized with center parent" button
Expected result
Both modal windows are displayed on the same monitor as their parent (the secondary monitor)
Actual result
In the case of the form with the value FormWindowState.Normal, it is shown in the parent's monitor.
However, in the form with value FormWindowState.Maximized it is always displayed on the main monitor.
Other observations
It has also been verified that changing the main monitor in the operating system and executing
the steps according to the change (move the application to the secondary monitor before
clicking on the buttons) the behavior is maintained.