This documentation is archived and is not being maintained.

Image Class

Updated: September 2008

An abstract base class that provides functionality for the Bitmap and Metafile descended classes.

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

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<TypeConverterAttribute(GetType(ImageConverter))> _
Public MustInherit Class Image _
	Inherits MarshalByRefObject _
	Implements ISerializable, ICloneable, IDisposable
Dim instance As Image

To draw an Image on a Windows Form, you should use one of the DrawImage(Image, Point) methods.

The following code example is designed for use with Windows Forms. It is a handler for the Paint event. A Graphics object is passed to the event and is used to draw the image on the form. The code performs the following actions:

  • Creates an image from a file named SampImag.jpg. This file must be located in the same folder as the application executable file.

  • Creates a point at which to draw the upper-left corner of the image.

  • Draws the unscaled image on the form.

Private Sub ImageExampleForm_Paint _
    (ByVal sender As System.Object, _
    ByVal e As System.Windows.Forms.PaintEventArgs) _
    Handles MyBase.Paint

    ' Create image. 
    Dim newImage As Image = Image.FromFile("SampImag.jpg")

    ' Create Point for upper-left corner of image. 
    Dim ulCorner As New Point(100, 100)

    ' Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner)
End Sub

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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0




September 2008

Updated code example.

Customer feedback.