MessageBox.Show— font change?

我们两清 提交于 2019-11-29 05:30:41

As far as I'm aware you can't, as the 'normal' dialog boxes are using your default system font settings.

Roll your own is probably the best way forward. It's fairly trivial to do, and much fun! And you can build in things that the standard dialog doesn't support (without PInvoke magic) such as centering in the middle of the screen etc.

Use a form with a Textbox and two Buttons OK, Cancel on it. Use this form instead of a MessageBox in the whole project. You can change the font, backColor, multiline etc of the textbox on the fly. You can change the size, color and font of the buttons too.

Tass

I would create my own MessageBox class for this purpose - BigMessageBox perhaps?. It would then be a matter of replacing MessageBox.Show with BigMessageBox.Show.

Another alternative is using windows hooks to modify the form - have a look at https://web.archive.org/web/20091208060754/http://msdn.microsoft.com/en-gb/magazine/cc188920.aspx for an example from .net 1.0. This may be easier in the current release, but I can't find an example for you.

please check out my free to use FlexibleMessageBox which can be used instead of MessageBox and has a (static) FONT-Property.

Regards, Jörg

There is a solution -- via installing CBT hook it is possible to adjust on the fly wide variety of MessageBox visual settings: message and button fonts, dialog background, dialog positioning, icons, button captions, timeout and so on.

Extended MessageBox .NET Assembly http://www.news2news.com/vfp/?solution=5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!