title: Fill Panel with gradient in three colors
body: <p>I'm working on project and I have to do kind of color picker using C#. </p>
  
  <p>So I've decided that it will be a Panel with this background in Win Forms App.</p>
  
  <p>Background should have gradient with three colors in rgb: red (0 - 255), blue (0 - 255) and green = 0.</p>
  
  <p><img src="https://i.stack.imgur.com/gu0oJ.png" alt="gu0oJ.png"></p>
  
  <p>But I can't find any information about what I should use for this.</p>
  
  <p>I tried to write some code and here is what I've done. </p>
  
  <pre><code>{
  public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
  
  
  
      private void Form1_Load(object sender, EventArgs e)
      {
          panel1.Paint += new PaintEventHandler(panel1_Paint);
          panel1.Refresh();
      }
  
      private void panel1_Paint(object sender, PaintEventArgs e)
      {
          Point startPoint = new Point(0, 0);
          Point endPoint = new Point(150, 150);
  
          LinearGradientBrush lgb =
              new LinearGradientBrush(startPoint, endPoint,     Color.FromArgb(255, 255, 0, 0), Color.FromArgb(255, 255, 255, 0));
          Graphics g = e.Graphics;
          g.FillRectangle(lgb, 0, 0, 150, 150);
         // g.DrawLine(new Pen(Color.Yellow, 1.5f), startPoint, endPoint);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And now I have panel with this gradient</p>
  
  <p><img src="https://i.stack.imgur.com/ORnzf.png" alt="ORnzf.png"></p>
  
  <p>What I should use to get gradient at first picture?</p>
  
  <p>And second question: What should I do to get the pixel color after clicking on this background?</p>