13.1. Understanding the Rendering Process

In previous chapters of this book, you learned how to draw graphics shapes, curves, and images. In all of these cases, the Graphics object is responsible for the drawing. When we’re drawing graphics objects from within a menu or button click event handler, a call to the Invalidate method becomes imperative. If we don’t call this method, the form will not paint itself, but if we write the same code on a form’s OnPaint or paint event handler, there is no need to invalidate the form. In this section we will find out why that’s so.

13.1.1. Understanding the Paint Event

Paint event functionality is defined in the System.Windows.Forms.Control class, which is the base class for Windows Forms controls such ...

Get Graphics Programming with GDI+ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.