How to show MessageBox at a specific point on the screen
How can I use MessageBox.Show("test")
and have it appear at a specific location on the screen. By defa开发者_如何学Cult, the message box is shown centered on the screen.
You've got two options:
- Write your own dialog form.
- Intercept the Windows messages directed to the dialog and set the position when the dialog is first shown.
The latter of these is probably easiest done by avoiding MessageBox
altogether and P/Invoking to the native message dialog API.
That said, I can't imagine why you'd want to avoid using the system default behaviour.
Syntax in C#:
MessageBox.top= 100;
MessageBox.left= 200;
精彩评论