views:

4753

answers:

4

Hi all,

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

+4  A: 

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.

Wim Hollebrandse
bummer, but I think you're right.Time to roll my own!
mmr
+1  A: 

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 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.

Tass
A: 

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.

Sr
+1  A: 

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

Anatoliy Mogylevets
looks nice-- but I've already rolled my own since writing this question.
mmr