Actualización: noviembre 2007
Clase base abstracta que proporciona funcionalidad para las clases descendentes Bitmap y Metafile.
<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <TypeConverterAttribute(GetType(ImageConverter))> _ Public MustInherit Class Image _ Inherits MarshalByRefObject _ Implements ISerializable, ICloneable, IDisposable
Dim instance As Image
[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
/** @attribute SerializableAttribute */ /** @attribute ComVisibleAttribute(true) */ /** @attribute TypeConverterAttribute(ImageConverter) */ public abstract class Image extends MarshalByRefObject implements ISerializable, ICloneable, IDisposable
public abstract class Image extends MarshalByRefObject implements ISerializable, ICloneable, IDisposable
El siguiente ejemplo está pensado para usarse con Windows Forms y requiere el parámetro e de PaintEventArgs, que es un parámetro del controlador de eventos Paint. El código realiza las acciones siguientes:
Crea una imagen a partir del archivo SampImag.jpg en la carpeta del ejemplo.
Crea un punto en el cual se dibujará la esquina superior izquierda de la imagen.
Dibuja la imagen sin ajustar a escala en la pantalla.
Private Sub DrawImagePoint(ByVal e As PaintEventArgs) ' 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 DrawImagePoint(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 DrawImagePoint( 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 ); }
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile para Smartphone, Windows Mobile para Pocket PC