title: How to add a custom EventHandler to the PaintEventHandler?
body: <p>As a C# exercise, I want to add a custom PaintEventHandler that draws a rectangle to my form whenever it is drawn. I have the following:</p>
  
  <p>1) A delegate</p>
  
  <pre><code>public delegate void MyPaintFormEventHandler(object sender, PaintEventArgs e);
  </code></pre>
  
  <p>2) A method to be executed, drawing the rectangle.</p>
  
  <pre><code>private void draw_red_rectangle(object sender, PaintEventArgs e)
  { /* Implementation here */ }
  </code></pre>
  
  <p>3) A subscription to the Paint event of the Form.</p>
  
  <pre><code>this.Paint += new MyPaintFormEventHandler(draw_red_rectangle);
  </code></pre>
  
  <p>However, this piece of code together does not compile, for the following reason:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type 'use_graphics.MyPaintFormEventHandler' to 'System.Windows.Forms.PaintEventHandler'</p>
  </blockquote>
  
  <p>Can anyone help me out by pinpointing what I am doing wrong and how I could fix this?</p>