title: changing panel colors
body: <p>I created a simple code here just to play around with C#. It has 3 buttons and 1 panel. If you click on the 2nd &amp; 3rd button the panel height changes. Is that also possible to change the color?</p>
  
  <p>For example, if I click on the 2nd button, I would like to have it as yellow and at the same time the height changes as well, and the same with 3rd button.</p>
  
  <pre><code>public partial class Form1 : Form
   {
  public int heightPanel;
  
    public Form1()
      {
    InitializeComponent();
    heightPanel = panel1.Height;
      }
  
    private void button1_Click(object sender, EventArgs e)
      {
    panel1.Height = heightPanel;
      }
  
    private void button2_Click(object sender, EventArgs e)
      {
    panel1.Height = this.Height/2;
      }
  
    private void button3_Click(object sender, EventArgs e)
      {
    panel1.Height = this.Height - 150;
      }
    }
  </code></pre>
  
  <p>I have an idea but I don't know where to put this. I think it would be something like this:</p>
  
  <pre><code>panel1.Height=this.BackColor.ToString();
  </code></pre>
  
  <p>Any inputs?</p>
  
  <h2>Response to reply</h2>
  
  <p>Yes, I would like to retain the 3 colors if I click in any of the button. I'm not sure if it's possible. For ex:</p>
  
  <pre><code>my button1 =pink
  button2=yellow
  button3=green
  </code></pre>
  
  <p>If I click on the button 1 I'll see the pink color, and if I click on the button2 I'll see the pink and yellow.</p>
  
  <p>Is that possible?</p>