0

I wanted to change the MessageBox font in my .NET CF application and found that it's not that easy (and even impossible).
some adviced to change the default font of windows , cause MessageBox uses that.
the handy way is : Desktop properties/Appearance/Advanced...
but how can i do that by code using .NET class libraries?
there's a property that gets the system default font for messagebox:

SystemFonts.MessageBoxFont

but how to set it?
i tried calling SystemParametersInfo() win32 native function in Windows XP and it worked with SPI value SPI_SETNONCLIENTMETRICS.

but in Win CE 5.0 it returns error code 1439 / ERROR_INVALID_SPI_VALUE that means setting some values like font does is not supported.
i googled and just found THIS page that listed the SPIs for Windows CE 3.0 and my SPI to set current default message box is not there.
so how can i change Windows default font for message boxes?

losingsleeep
  • 1,849
  • 7
  • 29
  • 46

1 Answers1

1

I doubt that there is a supported way to change this from code. That's a system wide option that the user is in control of. MS likes to avoid tempting developers to change such settings.

Even if there is a way to change the system wide setting from code I urge you not to do so. Instead write your own message box dialog and feel free to use whatever font you like.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • but if i show a Form object in my own custom MessageBox class as the dialog box, regarding to that i'm working on Windows CE 5.0 and .NET CF 3.5, it will be so heavy and is not fast! – losingsleeep Nov 05 '11 at 09:09
  • Speed is no issue here. The dialog waits for user input!! Absolutely no problem at all showing custom forms. – David Heffernan Nov 05 '11 at 09:17
  • maybe your're right, but when i try to show/hide a Form, it acts too slow. thanks howerver. – losingsleeep Nov 05 '11 at 10:49
  • Something else is wrong if showing a form with a label and a couple of buttons is slow – David Heffernan Nov 05 '11 at 10:50
  • not that slow that u think, but it's not as fast as an user alert like built in MessageBox, even so much slower. please test the both type and compare. – losingsleeep Nov 05 '11 at 11:55