Graphics.DrawImageUnscaled 方法

定义

在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。

重载

DrawImageUnscaled(Image, Int32, Int32)

在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。

DrawImageUnscaled(Image, Int32, Int32, Int32, Int32)

在指定的位置使用图像的原始物理大小绘制指定的图像。

DrawImageUnscaled(Image, Point)

在指定的位置使用图像的原始物理大小绘制指定的图像。

DrawImageUnscaled(Image, Rectangle)

在指定的位置使用图像的原始物理大小绘制指定的图像。

DrawImageUnscaled(Image, Int32, Int32)

在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。

public:
 void DrawImageUnscaled(System::Drawing::Image ^ image, int x, int y);
public void DrawImageUnscaled (System.Drawing.Image image, int x, int y);
member this.DrawImageUnscaled : System.Drawing.Image * int * int -> unit
Public Sub DrawImageUnscaled (image As Image, x As Integer, y As Integer)

参数

image
Image

要绘制的 Image

x
Int32

所绘制图像的左上角的 x 坐标。

y
Int32

所绘制图像的左上角的 y 坐标。

例外

imagenull

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse,这是事件处理程序的参数Paint。 此代码执行以下操作:

  • 从示例文件夹中的 JPEG 文件(SampImag.jpg)创建映像。

  • 创建一个点,用于绘制图像左上角的点。

  • 使用其物理大小绘制整个图像。

public:
   void DrawImageUnscaledInt( PaintEventArgs^ e )
   {
      // Create image.
      Image^ newImage = Image::FromFile( "SampImag.jpg" );

      // Create coordinates for upper-left corner of image.
      int x = 100;
      int y = 100;

      // Draw image to screen.
      e->Graphics->DrawImageUnscaled( newImage, x, y );
   }
public void DrawImageUnscaledInt(PaintEventArgs e)
{
             
    // Create image.
    Image newImage = Image.FromFile("SampImag.jpg");
             
    // Create coordinates for upper-left corner of image.
    int x = 100;
    int y = 100;
             
    // Draw image to screen.
    e.Graphics.DrawImageUnscaled(newImage, x, y);
}
Public Sub DrawImageUnscaledInt(ByVal e As PaintEventArgs)

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

    ' Create coordinates for upper-left corner of image.
    Dim x As Integer = 100
    Dim y As Integer = 100

    ' Draw image to screen.
    e.Graphics.DrawImageUnscaled(newImage, x, y)
End Sub

注解

存储 Image 像素宽度的值和水平分辨率的值 (每英寸点) 。 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。 例如,像素宽度为 216 且水平分辨率为每英寸 72 点的图像的物理宽度为 3 英寸。 类似的注释适用于像素高度和物理高度。

方法 DrawImageUnscaled 使用其物理大小绘制图像,因此无论显示设备) 分辨率 (每英寸点数如何,图像都将具有正确的大小(以英寸为单位)。 例如,假设图像的像素宽度为 216,水平分辨率为每英寸 72 点。 如果调用 DrawImageUnscaled 以在分辨率为每英寸 96 点的设备上绘制该图像,则呈现的图像的像素宽度将 (216/72) *96 = 288。

适用于

DrawImageUnscaled(Image, Int32, Int32, Int32, Int32)

在指定的位置使用图像的原始物理大小绘制指定的图像。

public:
 void DrawImageUnscaled(System::Drawing::Image ^ image, int x, int y, int width, int height);
public void DrawImageUnscaled (System.Drawing.Image image, int x, int y, int width, int height);
member this.DrawImageUnscaled : System.Drawing.Image * int * int * int * int -> unit
Public Sub DrawImageUnscaled (image As Image, x As Integer, y As Integer, width As Integer, height As Integer)

参数

image
Image

要绘制的 Image

x
Int32

所绘制图像的左上角的 x 坐标。

y
Int32

所绘制图像的左上角的 y 坐标。

width
Int32

未使用。

height
Int32

未使用。

例外

imagenull

注解

存储 Image 像素宽度的值和水平分辨率的值 (每英寸点) 。 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。 例如,像素宽度为 216 且水平分辨率为每英寸 72 点的图像的物理宽度为 3 英寸。 类似的注释适用于像素高度和物理高度。

方法 DrawImageUnscaled 使用其物理大小绘制图像,因此无论显示设备) 分辨率 (每英寸点数如何,图像都将具有正确的大小(以英寸为单位)。 例如,假设图像的像素宽度为 216,水平分辨率为每英寸 72 点。 如果调用 DrawImageUnscaled 以在分辨率为每英寸 96 点的设备上绘制该图像,则呈现的图像的像素宽度将 (216/72) *96 = 288。

适用于

DrawImageUnscaled(Image, Point)

在指定的位置使用图像的原始物理大小绘制指定的图像。

public:
 void DrawImageUnscaled(System::Drawing::Image ^ image, System::Drawing::Point point);
public void DrawImageUnscaled (System.Drawing.Image image, System.Drawing.Point point);
member this.DrawImageUnscaled : System.Drawing.Image * System.Drawing.Point -> unit
Public Sub DrawImageUnscaled (image As Image, point As Point)

参数

image
Image

要绘制的 Image

point
Point

Point 结构,它指定所绘制图像的左上角。

例外

imagenull

示例

下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse,这是事件处理程序的参数Paint。 此代码执行以下操作:

  • 从示例文件夹中的 JPEG 文件 SampImag.jpg 创建映像。

  • 创建一个点,用于绘制图像左上角的点。

  • 使用其物理大小绘制整个图像。

public:
   void DrawImageUnscaledPoint( 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->DrawImageUnscaled( newImage, ulCorner );
   }
public void DrawImageUnscaledPoint(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.DrawImageUnscaled(newImage, ulCorner);
}
Public Sub DrawImageUnscaledPoint(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.DrawImageUnscaled(newImage, ulCorner)
End Sub

注解

存储 Image 像素宽度的值和水平分辨率的值 (每英寸点) 。 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。 例如,像素宽度为 216 且水平分辨率为每英寸 72 点的图像的物理宽度为 3 英寸。 类似的注释适用于像素高度和物理高度。

方法 DrawImageUnscaled 使用其物理大小绘制图像,因此无论显示设备) 分辨率 (每英寸点数如何,图像都将具有正确的大小(以英寸为单位)。 例如,假设图像的像素宽度为 216,水平分辨率为每英寸 72 点。 如果调用 DrawImageUnscaled 以在分辨率为每英寸 96 点的设备上绘制该图像,则呈现的图像的像素宽度将 (216/72) *96 = 288。

适用于

DrawImageUnscaled(Image, Rectangle)

在指定的位置使用图像的原始物理大小绘制指定的图像。

public:
 void DrawImageUnscaled(System::Drawing::Image ^ image, System::Drawing::Rectangle rect);
public void DrawImageUnscaled (System.Drawing.Image image, System.Drawing.Rectangle rect);
member this.DrawImageUnscaled : System.Drawing.Image * System.Drawing.Rectangle -> unit
Public Sub DrawImageUnscaled (image As Image, rect As Rectangle)

参数

image
Image

要绘制的 Image

rect
Rectangle

Rectangle,它指定了所绘制图像的左上角。 该矩形的 X 和 Y 属性指定左上角。 宽度和高度属性被忽略。

例外

imagenull

注解

存储 Image 像素宽度的值和水平分辨率的值 (每英寸点) 。 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。 例如,像素宽度为 216 且水平分辨率为每英寸 72 点的图像的物理宽度为 3 英寸。 类似的注释适用于像素高度和物理高度。

方法 DrawImageUnscaled 使用其物理大小绘制图像,因此无论显示设备) 分辨率 (每英寸点数如何,图像都将具有正确的大小(以英寸为单位)。 例如,假设图像的像素宽度为 216,水平分辨率为每英寸 72 点。 如果调用 DrawImageUnscaled 以在分辨率为每英寸 96 点的设备上绘制该图像,则呈现的图像的像素宽度将 (216/72) *96 = 288。

适用于