Losing Focus after MessageBox::Show
When doing the window form application assignment, just find out that after MessageBox::Show, the window form will lose its focus.
Reason:
| Member name | Description | |
|---|---|---|
| ServiceNotification | The message box is displayed on the active desktop. | |
| DefaultDesktopOnly | The message box is displayed on the active desktop. | |
| RightAlign | The message box text is right-aligned. | |
| RtlReading | Specifies that the message box text is displayed with right to left reading order. |
Because once you use one of the two top options, the focus will move to previous active application.
Solution:
Just simply remove the MessageBoxOptions in MessageBox::Show call.
Reference:
http://msdn.microsoft.com/en-us/library/system.windows.forms.messageboxoptions.aspx
Apply to:
C++/CLI
