Reputation: 59
In one of our windows apps, a dialog box is launched using MessageBox.Show, which is working fine on win 7 and 8. But on Win 10, the popup is shown below the launcher. Any guess how to rectify this?
thanks
Upvotes: 0
Views: 47
Reputation: 4223
Use the MessageBox.Show overload that allows you to specific a parent window: https://msdn.microsoft.com/en-us/library/cked7698(v=vs.110).aspx
If you are using WPF/UWP, you can write something like this:
Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
() => MessageBox.Show(Application.Current.MainWindow, msg));
An alternative way to hack the same functionality without a specific window is this:
Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
() => MessageBox.Show(new Form { TopMost = true }, msg);
Upvotes: 1