locked
Changing Background color in MessageBox RRS feed

  • Question

  • Is there an easy way to change the background color of a MessageBox, short of changing the Color Scheme under the Appearance tab of the Display Properties.  I guess I could create my own mini-form, but was hoping not to have to go there.  I'd like to do it programatically (in C#).  I want to display the results of a process in the MessageBox, and wanted the background color to match my app background color.  Thanks.

    MattM

    Monday, November 21, 2011 2:45 PM

Answers

  • Create a new form, which would be your message box. But the buttons and maybe an image (notification icon) on, and change the background color (or put some image as a background image).

     


    Mitja
    • Proposed as answer by Thorsten Gudera Monday, November 21, 2011 6:01 PM
    • Marked as answer by Helen Zhou Tuesday, November 29, 2011 5:38 AM
    Monday, November 21, 2011 4:20 PM
  • Hello MattMen,

    Yes, custom your own MessageBox with the style match your Main form. And here has a demo about custom a messagebox which "can be incorporate it into their applicationsIn this article I will explain how to create a simple OK/Cancel message box. I will also make some suggestions on how you can improve on the message box by adding a timer feature. "

    http://www.codeproject.com/KB/cs/A_Custom_Message_Box.aspx
    http://www.codeproject.com/KB/cs/CustomMessageBox.aspx

    Sincerely,
    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Helen Zhou Tuesday, November 29, 2011 5:38 AM
    Tuesday, November 22, 2011 5:20 AM
  • > Is there an easy way to change the background color of a MessageBox ...

    Nope.

    > ... short of changing the Color Scheme under the Appearance tab of the Display Properties. 

    Don't even think about it. 
    Seriously. 
    You'd be astonished how defensive people get about their PC and the way that they choose to set it up.

    > I guess I could create my own mini-form, but was hoping not to have to go there. 

    Sorry but that is the way to go.

    > I want to display the results of a process in the MessageBox ...

    Any particular reason?  Dialogs are nasty, intrusive things that break the user's workflow - that's what they're designed to do; stop the user in their tracks until they've dealt with this popped-up thing.

    > ... and wanted the background color to match my app background color.

    So your application isn't following the colour scheme chosen by the user for their PC?  Unless you have a very Good Reason for doing this, I would reconsider that decision.  Part of the success of Windows is that every application [more or less] looks the same and [more or less] behaves the same way.  If you deliberately flaunt this convention, your users are likely to get confused and start filing bug reports because things aren't the way that they expect them to be. 



    Regards, Phill W.
    • Marked as answer by Helen Zhou Tuesday, November 29, 2011 5:38 AM
    Tuesday, November 22, 2011 1:33 PM

All replies

  • Create a new form, which would be your message box. But the buttons and maybe an image (notification icon) on, and change the background color (or put some image as a background image).

     


    Mitja
    • Proposed as answer by Thorsten Gudera Monday, November 21, 2011 6:01 PM
    • Marked as answer by Helen Zhou Tuesday, November 29, 2011 5:38 AM
    Monday, November 21, 2011 4:20 PM
  • Hello MattMen,

    Yes, custom your own MessageBox with the style match your Main form. And here has a demo about custom a messagebox which "can be incorporate it into their applicationsIn this article I will explain how to create a simple OK/Cancel message box. I will also make some suggestions on how you can improve on the message box by adding a timer feature. "

    http://www.codeproject.com/KB/cs/A_Custom_Message_Box.aspx
    http://www.codeproject.com/KB/cs/CustomMessageBox.aspx

    Sincerely,
    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Helen Zhou Tuesday, November 29, 2011 5:38 AM
    Tuesday, November 22, 2011 5:20 AM
  • > Is there an easy way to change the background color of a MessageBox ...

    Nope.

    > ... short of changing the Color Scheme under the Appearance tab of the Display Properties. 

    Don't even think about it. 
    Seriously. 
    You'd be astonished how defensive people get about their PC and the way that they choose to set it up.

    > I guess I could create my own mini-form, but was hoping not to have to go there. 

    Sorry but that is the way to go.

    > I want to display the results of a process in the MessageBox ...

    Any particular reason?  Dialogs are nasty, intrusive things that break the user's workflow - that's what they're designed to do; stop the user in their tracks until they've dealt with this popped-up thing.

    > ... and wanted the background color to match my app background color.

    So your application isn't following the colour scheme chosen by the user for their PC?  Unless you have a very Good Reason for doing this, I would reconsider that decision.  Part of the success of Windows is that every application [more or less] looks the same and [more or less] behaves the same way.  If you deliberately flaunt this convention, your users are likely to get confused and start filing bug reports because things aren't the way that they expect them to be. 



    Regards, Phill W.
    • Marked as answer by Helen Zhou Tuesday, November 29, 2011 5:38 AM
    Tuesday, November 22, 2011 1:33 PM