Skip to content

Center dialogs and message boxes on their parent window - #106

Open
Tomas Hansson (tomashan) wants to merge 1 commit into
microsoft:masterfrom
tomashan:center-dialogs-on-parent
Open

Center dialogs and message boxes on their parent window#106
Tomas Hansson (tomashan) wants to merge 1 commit into
microsoft:masterfrom
tomashan:center-dialogs-on-parent

Conversation

@tomashan

Copy link
Copy Markdown

Summary

Dialogs and message boxes were shown without an explicit owner, so FormStartPosition.CenterParent had no parent to center against and placement fell back to inconsistent, sometimes off-monitor behavior (especially for non-modal Form.Show(), which never infers an owner).

This change passes the parent form explicitly to ShowDialog/Show/MessageBox.Show throughout MainForm, RDPConnect, AssetLibrarySearch, AddNSG, Parameters, and ChooseProject, so every dialog centers on and stays stacked above its parent, on the parent's monitor.

Test plan

  • Built the solution locally (msbuild 2LCS.sln) — succeeds with no warnings/errors
  • Verified each touched form still compiles and dialog/messagebox calls pass the correct owner

Dialogs and message boxes were shown without an explicit owner, so
FormStartPosition.CenterParent had no parent to center against and
placement fell back to inconsistent, sometimes off-monitor behavior
(especially for non-modal Form.Show(), which never infers an owner).
Passing the parent form explicitly to ShowDialog/Show/MessageBox.Show
throughout MainForm, RDPConnect, AssetLibrarySearch, AddNSG,
Parameters, and ChooseProject makes every dialog center on and stay
stacked above its parent, on the parent's monitor.
@tomashan

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants