Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Dispose Method

Graphics.Dispose Method

Releases all resources used by this Graphics.

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

abstract Dispose : unit -> unit  
override Dispose : unit -> unit

Implements

IDisposable.Dispose()

Calling Dispose allows the resources used by this Graphics to be reallocated for other purposes.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgs e, which is a parameter of the Paint event handler. The code performs the following actions:

  • Creates an Image from a graphics file SampImag.jpg in the example directory.

  • Creates a Graphics from the Image.

  • Alters the image by filling a rectangle within it.

  • Draws the Image to the screen.

  • Releases the created Graphics.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft