Raises the Paint event.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Raising an event invokes the event handler through a delegate. For more information, see Handling and Raising Events.
The method also enables derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.Notes to Inheritors
When overriding in a derived class, be sure to call the base class's method so that registered delegates receive the event.
The following code example enables the user to drag an image or image file onto the form, and have it be displayed at the point on which it is dropped. The method is overridden to repaint the image each time the form is painted; otherwise the image would only persist until the next repainting. The DragEnter event-handling method determines the type of data being dragged into the form and provides the appropriate feedback. The DragDrop event-handling method displays the image on the form, if an Image can be created from the data. Because the DragEventArgs.X and DragEventArgs.Y values are screen coordinates, the example uses the PointToClient method to convert them to client coordinates.