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)
Visual Basic (Declaration)
<SerializableAttribute> _
<ComVisibleAttribute(True)> _
<TypeConverterAttribute(GetType(ImageConverter))> _
Public MustInherit Class Image _
Inherits MarshalByRefObject _
Implements ISerializable, ICloneable, IDisposable
[SerializableAttribute]
[ComVisibleAttribute(true)]
[TypeConverterAttribute(typeof(ImageConverter))]
public abstract class Image : MarshalByRefObject,
ISerializable, ICloneable, IDisposable
[SerializableAttribute]
[ComVisibleAttribute(true)]
[TypeConverterAttribute(typeof(ImageConverter))]
public ref class Image abstract : public MarshalByRefObject,
ISerializable, ICloneable, IDisposable
public abstract class Image extends MarshalByRefObject implements ISerializable, ICloneable, IDisposable
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
private void ImageExampleForm_Paint(object sender, PaintEventArgs e)
{
// Create image.
Image newImage = Image.FromFile("SampImag.jpg");
// Create Point for upper-left corner of image.
Point ulCorner = new Point(100, 100);
// Draw image to screen.
e.Graphics.DrawImage(newImage, ulCorner);
}
private:
void ImageExampleForm_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e)
{
// Create image.
Image^ newImage = Image::FromFile( "SampImag.jpg" );
// Create Point for upper-left corner of image.
Point ulCorner = Point(100,100);
// Draw image to screen.
e->Graphics->DrawImage( newImage, ulCorner );
}
System..::.Object
System..::.MarshalByRefObject
System.Drawing..::.Image
System.Drawing..::.Bitmap
System.Drawing.Imaging..::.Metafile
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
Reference
Date | History | Reason |
|---|
September 2008
| Updated code example. |
Customer feedback.
|