开发者

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:

  1. Write your own dialog form.
  2. 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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜