public ref class Image abstract : MarshalByRefObject, ICloneable, IDisposable, System::Runtime::Serialization::ISerializable
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))]
public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
[System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public abstract class Image : MarshalByRefObject, ICloneable, IDisposable, System.Runtime.Serialization.ISerializable
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
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))>]
type Image = class
inherit MarshalByRefObject
interface ICloneable
interface IDisposable
interface ISerializable
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.ImageConverter))>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type Image = class
inherit MarshalByRefObject
interface ISerializable
interface ICloneable
interface IDisposable
Public MustInherit Class Image
Inherits MarshalByRefObject
Implements ICloneable, IDisposable, ISerializable
Image
下列程式碼範例是專為搭配 Windows Forms 使用而設計。 它是事件的處理常式
Paint
。
Graphics
物件會傳遞至 事件,並用來在表單上繪製影像。 此程式碼會執行下列動作:
從名為 SampImag.jpg 的檔案建立映射。 此檔案必須位於與應用程式可執行檔相同的資料夾中。
建立要繪製影像左上角的點。
在表單上繪製未調整的影像。
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
若要在 Windows Form 上繪製
Image
,請使用其中
DrawImage
一種方法。
在 .net 6 和更新版本中,只有在 Windows 的作業系統上才支援包含此類型的「
系統繪圖」套件
。 在跨平臺應用程式中使用此類型會導致編譯時期警告和執行時間例外狀況。 如需詳細資訊,請參閱
System. Drawing。 Windows 僅支援 Common
。