开发者

How to show MessageBox at a specific point on the screen

开发者 https://www.devze.com 2023-02-19 04:02 出处:网络
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:

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

精彩评论

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