Graphics.DrawImageUnscaled 方法

定义

在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。Draws the specified image using its original physical size at the location specified by a coordinate pair.

重载

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

在指定的位置使用图像的原始物理大小绘制指定的图像。Draws a specified image using its original physical size at a specified location.

DrawImageUnscaled(Image, Int32, Int32)

在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。Draws the specified image using its original physical size at the location specified by a coordinate pair.

DrawImageUnscaled(Image, Point)

在指定的位置使用图像的原始物理大小绘制指定的图像。Draws a specified image using its original physical size at a specified location.

DrawImageUnscaled(Image, Rectangle)

在指定的位置使用图像的原始物理大小绘制指定的图像。Draws a specified image using its original physical size at a specified location.

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

在指定的位置使用图像的原始物理大小绘制指定的图像。Draws a specified image using its original physical size at a specified location.

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

要绘制的 ImageImage to draw.

x
Int32

所绘制图像的左上角的 x 坐标。The x-coordinate of the upper-left corner of the drawn image.

y
Int32

所绘制图像的左上角的 y 坐标。The y-coordinate of the upper-left corner of the drawn image.

width
Int32

未使用。Not used.

height
Int32

未使用。Not used.

例外

imagenullimage is null.

注解

用于 Image 存储像素宽度值和水平分辨率的值 (每英寸点) 。An Image stores a value for pixel width and a value for horizontal resolution (dots per inch). 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。The physical width, measured in inches, of an image is the pixel width divided by the horizontal resolution. 例如,像素宽度为216、水平分辨率为72点/英寸的图像的物理宽度为3英寸。For example, an image with a pixel width of 216 and a horizontal resolution of 72 dots per inch has a physical width of 3 inches. 类似的备注适用于像素高度和物理高度。Similar remarks apply to pixel height and physical height.

DrawImageUnscaled方法使用其物理尺寸绘制图像,因此,无论分辨率 (点/英寸) 的显示设备的分辨率如何,图像的大小均为英寸。The DrawImageUnscaled method draws an image using its physical size, so the image will have its correct size in inches regardless of the resolution (dots per inch) of the display device. 例如,假设某个图像的像素宽度为216,水平分辨率为每英寸72点。For example, suppose an image has a pixel width of 216 and a horizontal resolution of 72 dots per inch. 如果调用 DrawImageUnscaled 以将该图像绘制到分辨率为96点/英寸的设备上,则呈现的图像的像素宽度将为 (216/72) * 96 = 288。If you call DrawImageUnscaled to draw that image on a device that has a resolution of 96 dots per inch, the pixel width of the rendered image will be (216/72)*96 = 288.

适用于

DrawImageUnscaled(Image, Int32, Int32)

在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。Draws the specified image using its original physical size at the location specified by a coordinate pair.

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

要绘制的 ImageImage to draw.

x
Int32

所绘制图像的左上角的 x 坐标。The x-coordinate of the upper-left corner of the drawn image.

y
Int32

所绘制图像的左上角的 y 坐标。The y-coordinate of the upper-left corner of the drawn image.

例外

imagenullimage is null.

示例

下面的代码示例旨在与 Windows 窗体一起使用,并且它需要作为 PaintEventArgs e Paint 事件处理程序的参数。The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 此代码执行以下操作:The code performs the following actions:

  • 在示例的文件夹中,通过 JPEG 文件 SampImag.jpg 创建图像。Creates an image from a JPEG file, SampImag.jpg, in the folder of the example.

  • 创建一个点,在该点绘制图像的左上角。Creates a point at which to draw the upper-left corner of the image.

  • 使用物理尺寸绘制整个图像。Draws the entire image using its physical size.

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 存储像素宽度值和水平分辨率的值 (每英寸点) 。An Image stores a value for pixel width and a value for horizontal resolution (dots per inch). 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。The physical width, measured in inches, of an image is the pixel width divided by the horizontal resolution. 例如,像素宽度为216、水平分辨率为72点/英寸的图像的物理宽度为3英寸。For example, an image with a pixel width of 216 and a horizontal resolution of 72 dots per inch has a physical width of 3 inches. 类似的备注适用于像素高度和物理高度。Similar remarks apply to pixel height and physical height.

DrawImageUnscaled方法使用其物理尺寸绘制图像,因此,无论分辨率 (点/英寸) 的显示设备的分辨率如何,图像的大小均为英寸。The DrawImageUnscaled method draws an image using its physical size, so the image will have its correct size in inches regardless of the resolution (dots per inch) of the display device. 例如,假设某个图像的像素宽度为216,水平分辨率为每英寸72点。For example, suppose an image has a pixel width of 216 and a horizontal resolution of 72 dots per inch. 如果调用 DrawImageUnscaled 以将该图像绘制到分辨率为96点/英寸的设备上,则呈现的图像的像素宽度将为 (216/72) * 96 = 288。If you call DrawImageUnscaled to draw that image on a device that has a resolution of 96 dots per inch, the pixel width of the rendered image will be (216/72)*96 = 288.

适用于

DrawImageUnscaled(Image, Point)

在指定的位置使用图像的原始物理大小绘制指定的图像。Draws a specified image using its original physical size at a specified location.

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

要绘制的 ImageImage to draw.

point
Point

Point 结构,它指定所绘制图像的左上角。Point structure that specifies the upper-left corner of the drawn image.

例外

imagenullimage is null.

示例

下面的代码示例旨在与 Windows 窗体一起使用,并且它需要作为 PaintEventArgs e Paint 事件处理程序的参数。The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 此代码执行以下操作:The code performs the following actions:

  • 从示例的文件夹中 SampImag.jpg 的 JPEG 文件创建图像。Creates an image from a JPEG file SampImag.jpg in the folder of the example.

  • 创建一个点,在该点绘制图像的左上角。Creates a point at which to draw the upper-left corner of the image.

  • 使用物理尺寸绘制整个图像。Draws the entire image using its physical size.

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 存储像素宽度值和水平分辨率的值 (每英寸点) 。An Image stores a value for pixel width and a value for horizontal resolution (dots per inch). 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。The physical width, measured in inches, of an image is the pixel width divided by the horizontal resolution. 例如,像素宽度为216、水平分辨率为72点/英寸的图像的物理宽度为3英寸。For example, an image with a pixel width of 216 and a horizontal resolution of 72 dots per inch has a physical width of 3 inches. 类似的备注适用于像素高度和物理高度。Similar remarks apply to pixel height and physical height.

DrawImageUnscaled方法使用其物理尺寸绘制图像,因此,无论分辨率 (点/英寸) 的显示设备的分辨率如何,图像的大小均为英寸。The DrawImageUnscaled method draws an image using its physical size, so the image will have its correct size in inches regardless of the resolution (dots per inch) of the display device. 例如,假设某个图像的像素宽度为216,水平分辨率为每英寸72点。For example, suppose an image has a pixel width of 216 and a horizontal resolution of 72 dots per inch. 如果调用 DrawImageUnscaled 以将该图像绘制到分辨率为96点/英寸的设备上,则呈现的图像的像素宽度将为 (216/72) * 96 = 288。If you call DrawImageUnscaled to draw that image on a device that has a resolution of 96 dots per inch, the pixel width of the rendered image will be (216/72)*96 = 288.

适用于

DrawImageUnscaled(Image, Rectangle)

在指定的位置使用图像的原始物理大小绘制指定的图像。Draws a specified image using its original physical size at a specified location.

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

要绘制的 ImageImage to draw.

rect
Rectangle

Rectangle,它指定了所绘制图像的左上角。Rectangle that specifies the upper-left corner of the drawn image. 该矩形的 X 和 Y 属性指定左上角。The X and Y properties of the rectangle specify the upper-left corner. 宽度和高度属性被忽略。The Width and Height properties are ignored.

例外

imagenullimage is null.

注解

用于 Image 存储像素宽度值和水平分辨率的值 (每英寸点) 。An Image stores a value for pixel width and a value for horizontal resolution (dots per inch). 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。The physical width, measured in inches, of an image is the pixel width divided by the horizontal resolution. 例如,像素宽度为216、水平分辨率为72点/英寸的图像的物理宽度为3英寸。For example, an image with a pixel width of 216 and a horizontal resolution of 72 dots per inch has a physical width of 3 inches. 类似的备注适用于像素高度和物理高度。Similar remarks apply to pixel height and physical height.

DrawImageUnscaled方法使用其物理尺寸绘制图像,因此,无论分辨率 (点/英寸) 的显示设备的分辨率如何,图像的大小均为英寸。The DrawImageUnscaled method draws an image using its physical size, so the image will have its correct size in inches regardless of the resolution (dots per inch) of the display device. 例如,假设某个图像的像素宽度为216,水平分辨率为每英寸72点。For example, suppose an image has a pixel width of 216 and a horizontal resolution of 72 dots per inch. 如果调用 DrawImageUnscaled 以将该图像绘制到分辨率为96点/英寸的设备上,则呈现的图像的像素宽度将为 (216/72) * 96 = 288。If you call DrawImageUnscaled to draw that image on a device that has a resolution of 96 dots per inch, the pixel width of the rendered image will be (216/72)*96 = 288.

适用于