none
ReadOnly BackColor Property

    Question

  • I have a form with three buttons on called btnRed, btnGreen and btnBlu. I want to be able to change the background colour of the form when I click on one of these buttons with a nice fade effect, but the colour value is readonly. So this code doesn't work:

    me.BackColor.R = 155

    This next line does, but it doesn't allow me to increment the colour value to do a fade effect.

    Me.BackColor = Color.Red

    Is there any way of setting the R G and B values of BackColor?

    Friday, August 26, 2005 1:35 PM

Answers

  • hi,

    this works:



    Me.BackColor = Color.FromArgb(155, 155, 155)

     


    this is one of the color.fromargb method overloads just look for the one that fits to yours.
    Friday, August 26, 2005 1:54 PM
    Moderator

All replies

  • hi,

    this works:



    Me.BackColor = Color.FromArgb(155, 155, 155)

     


    this is one of the color.fromargb method overloads just look for the one that fits to yours.
    Friday, August 26, 2005 1:54 PM
    Moderator
  • That works perfectly thanks. Didn't see that with all the colours listed in the class.
    Friday, August 26, 2005 4:50 PM