title: How to use the OnPaint event in C#?
body: <p>i saw some similar questions on the site but none of them really helped me.</p>
  
  <p>I have a function that draws a few lines on the form when a button is clicked that vary in shape depending on the values the user enters in some textboxes.</p>
  
  <p>My problem is that when i minimize the form, the lines disappear and i understood that this can be resolved by using the OnPaint event, but i don't really understand how.</p>
  
  <p>Can anyone give me a simple example of using a function to draw something at the push of a button using the OnPaint event?</p>