在父窗体中心的MessageBox [英] center MessageBox in parent form

查看:171
本文介绍了在父窗体中心的MessageBox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法来中心的MessageBox在.NET 2.0父窗体

Is there a easy way to center MessageBox in parent form in .net 2.0

推荐答案

从上的乔尔斯波斯基的博客

一个消息始终集中在屏幕上。你可以提供一个老板,但也只是对Z顺序,不能定心。唯一的方法是使用Win32的挂钩和自己居中。你可以找到code,网上做的,如果你寻找它。

A Messagebox is always centered on the screen. You can provide an owner, but that is just for Z-order, not centering. The only way is to use Win32 hooks and center it yourself. You can find code doing that online if you search for it.

容易得多是只写自己的消息框类,并添加中心的功能。那么你也可以添加默认字幕,不再显示,复选框,使他们无模式。

Much easier is to just write your own message box class and add centering functionality. Then you can also add default captioning, Do not show again-checkbox and making them modeless.

的Win32挂钩大概是指使用 SetWindowsHookEx函数所示的这个例子

"Win32 hooks" probably refers to using SetWindowsHookEx as shown in this example.

这篇关于在父窗体中心的MessageBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆