PaintEventArgs Class

 

Provides data for the Paint event.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

System.Object
  System.EventArgs
    System.Windows.Forms.PaintEventArgs
      System.Windows.Forms.TableLayoutCellPaintEventArgs

type PaintEventArgs = 
    class
        inherit EventArgs
        interface IDisposable
    end

NameDescription
System_CAPS_pubmethodPaintEventArgs(Graphics, Rectangle)

Initializes a new instance of the PaintEventArgs class with the specified graphics and clipping rectangle.

NameDescription
System_CAPS_pubpropertyClipRectangle

Gets the rectangle in which to paint.

System_CAPS_pubpropertyGraphics

Gets the graphics used to paint.

NameDescription
System_CAPS_pubmethodDispose()

Releases all resources used by the PaintEventArgs.

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the PaintEventArgs and optionally releases the managed resources.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Overrides Object.Finalize().)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

The Paint event occurs when a control is redrawn. A PaintEventArgs specifies the Graphics to use to paint the control and the ClipRectangle in which to paint.

For information about the event model, see Handling and Raising Events.

The following example demonstrates handling the Paint event and using the PaintEventArgs class to draw rectangles on the form. The MouseDown and MouseUp events are handled to determine the size of the rectangle. The example also demonstrates the Invalidate method to invalidate the area of the rectangle, causing it to be redrawn.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: