Question

I'm using the MessageBox class to show errors to users, and while that might not be the right behavior, it's very convenient. This is a touchscreen application, however, so I need the 'ok' button to be much larger than it is (curse my inordinately large fingers!).

I think that if I increase the font size in the dialog box, I should be ok. Is there a way to do that? Or really, is there any way to increase the dialog size?

Thanks

Was it helpful?

Solution

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.

OTHER TIPS

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.

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.

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

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

Regards, Jörg

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top