locked
Dialog Box Color? RRS feed

  • Question

  • Changing the background color of a label is simple ... gLbl.BackColor = Color.LightGray.

    What color matches the color of the dialog box?


    cte677

    Tuesday, May 29, 2012 12:00 PM

Answers

  • I think that SystemColors.Control matches the colour of the dialog box.

    Programmatically you can try this:

    myLabel.BackColor = myLabel.Parent.BackColor;


    • Edited by Viorel_MVP Tuesday, May 29, 2012 12:42 PM
    • Proposed as answer by deadManN Tuesday, May 29, 2012 4:53 PM
    • Marked as answer by cte677 Tuesday, May 29, 2012 6:10 PM
    Tuesday, May 29, 2012 12:39 PM

All replies

  • As far as I know, there isn't a way of tweaking the MessageBox dialog, to do as you say, you need to create a new form and apply custom attributes, you can just create a label with text and an 'OK' button:

    MessageBox image

    You can even make your own functions to set the font's color, weight, size ...

    Tuesday, May 29, 2012 12:18 PM
  • Hi,

     You can create a custom class by inheriting MessageBox class and have your custom design for it and call your customMessageBox whenever needed.


    Sai Kumar K (MCP)
    Blog: Sai's Stuff.
    WebSite: SantoshTechnologies.

    Tuesday, May 29, 2012 12:27 PM
  • I think that SystemColors.Control matches the colour of the dialog box.

    Programmatically you can try this:

    myLabel.BackColor = myLabel.Parent.BackColor;


    • Edited by Viorel_MVP Tuesday, May 29, 2012 12:42 PM
    • Proposed as answer by deadManN Tuesday, May 29, 2012 4:53 PM
    • Marked as answer by cte677 Tuesday, May 29, 2012 6:10 PM
    Tuesday, May 29, 2012 12:39 PM
  • That works.  Thanks!

    I tried this.BackColor ... works too.  Don't know if there is any risk in this approach.


    cte677

    Tuesday, May 29, 2012 6:10 PM