blog:2023-09-22_c_messagebox.show_c_at_center_of_parent
2023-09-22 C#: messagebox.show c# at center of parent
When using the MessageBox.Show() method in C#, you can center the message box in the parent window by setting the second parameter to MessageBoxOptions.DefaultDesktopOnly.
MessageBox.Show(this,
"Content",
"Title",
MessageBoxButtons.OK,
MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1,
MessageBoxOptions.DefaultDesktopOnly);
The first parameter “this” refers to the current window, which is the parent window.
If the parent window does not have focus, the message box will be centered on the desktop.
Permalink blog/2023-09-22_c_messagebox.show_c_at_center_of_parent.txt · Last modified: 2023/09/22 11:36 by
jethro