locked
Change button colour back to default colour RRS feed

  • Question

  • My VB2010 programme changes the background colour of a button (butExtra.BackColor = Color.Red). But how do I restore the colour to the default "Control" colour?

     

    Thursday, April 8, 2010 6:51 PM

Answers

  •  

    Those System defined colors can be accessed using Known Colors Enumeration. You could use it like :

     

     butExtra.BackColor = Color.FromKnownColor(KnownColor.Control)

     


    Thanks

    "Feel the Force !"
    • Marked as answer by PeterBDa Thursday, April 8, 2010 7:44 PM
    Thursday, April 8, 2010 7:15 PM
  • If I recall correctly, it is:

    Color.FromKnownColor(KnownColor.Control)
    Hope this helps.
    www.insteptech.com ; msmvps.com/blogs/deborahk
    We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
    • Marked as answer by PeterBDa Thursday, April 8, 2010 7:44 PM
    Thursday, April 8, 2010 7:16 PM

All replies

  •  

    Those System defined colors can be accessed using Known Colors Enumeration. You could use it like :

     

     butExtra.BackColor = Color.FromKnownColor(KnownColor.Control)

     


    Thanks

    "Feel the Force !"
    • Marked as answer by PeterBDa Thursday, April 8, 2010 7:44 PM
    Thursday, April 8, 2010 7:15 PM
  • If I recall correctly, it is:

    Color.FromKnownColor(KnownColor.Control)
    Hope this helps.
    www.insteptech.com ; msmvps.com/blogs/deborahk
    We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
    • Marked as answer by PeterBDa Thursday, April 8, 2010 7:44 PM
    Thursday, April 8, 2010 7:16 PM