This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
public ref class Image abstract : MarshalByRefObject, ICloneable, IDisposable, System::Runtime::Serialization::ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))]
[System.Serializable]
public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))]
public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter("System.Drawing.ImageConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")]
public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))>]
[<System.Serializable>]
type Image = class
inherit MarshalByRefObject
interface IDisposable
interface ICloneable
interface ISerializable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Image = class
inherit MarshalByRefObject
interface ISerializable
interface ICloneable
interface IDisposable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))>]
type Image = class
inherit MarshalByRefObject
interface ICloneable
interface IDisposable
interface ISerializable
[<System.ComponentModel.TypeConverter("System.Drawing.ImageConverter, System.Windows.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51")>]
type Image = class
inherit MarshalByRefObject
interface ICloneable
interface IDisposable
interface ISerializable
Public MustInherit Class Image
Inherits MarshalByRefObject
Implements ICloneable, IDisposable, ISerializable
Inheritance
Image
Examples
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:
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 );
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 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
To draw an Image on a Windows Form, use one of the DrawImage methods.
In .NET 6 and later versions, the System.Drawing.Common package, which includes this type, is only supported on Windows operating systems. Use of this type in cross-platform apps causes compile-time warnings and run-time exceptions. For more information, see System.Drawing.Common only supported on Windows.
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject)
Obsolete.
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Obsolete.
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)