Graphics.DrawImageUnscaled 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。
重载
DrawImageUnscaled(Image, Int32, Int32) |
在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。 |
DrawImageUnscaled(Image, Int32, Int32, Int32, Int32) |
在指定的位置使用图像的原始物理大小绘制指定的图像。 |
DrawImageUnscaled(Image, Point) |
在指定的位置使用图像的原始物理大小绘制指定的图像。 |
DrawImageUnscaled(Image, Rectangle) |
在指定的位置使用图像的原始物理大小绘制指定的图像。 |
DrawImageUnscaled(Image, Int32, Int32)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
在由坐标对指定的位置,使用图像的原始物理大小绘制指定的图像。
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)
参数
- x
- Int32
所绘制图像的左上角的 x 坐标。
- y
- Int32
所绘制图像的左上角的 y 坐标。
例外
image
为 null
。
示例
下面的代码示例旨在与 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)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
在指定的位置使用图像的原始物理大小绘制指定的图像。
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)
参数
- x
- Int32
所绘制图像的左上角的 x 坐标。
- y
- Int32
所绘制图像的左上角的 y 坐标。
- width
- Int32
未使用。
- height
- Int32
未使用。
例外
image
为 null
。
注解
Image存储像素宽度的值和水平分辨率的值 (每英寸点) 。 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。 例如,像素宽度为 216、水平分辨率为每英寸 72 点的图像的物理宽度为 3 英寸。 类似的备注适用于像素高度和物理高度。
方法 DrawImageUnscaled 使用其物理大小绘制图像,因此无论显示设备) 分辨率 (每英寸点数如何,图像都将具有正确的英寸大小。 例如,假设图像的像素宽度为 216,水平分辨率为每英寸 72 点。 如果调用 DrawImageUnscaled 以在分辨率为每英寸 96 点的设备上绘制该图像,则呈现的图像的像素宽度将 (216/72) *96 = 288。
适用于
DrawImageUnscaled(Image, Point)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
在指定的位置使用图像的原始物理大小绘制指定的图像。
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
为 null
。
示例
下面的代码示例旨在与 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)
- Source:
- Graphics.cs
- Source:
- Graphics.cs
- Source:
- Graphics.cs
在指定的位置使用图像的原始物理大小绘制指定的图像。
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
为 null
。
注解
Image存储像素宽度的值和水平分辨率的值 (每英寸点) 。 图像的物理宽度(以英寸为单位)是像素宽度除以水平分辨率。 例如,像素宽度为 216、水平分辨率为每英寸 72 点的图像的物理宽度为 3 英寸。 类似的备注适用于像素高度和物理高度。
方法 DrawImageUnscaled 使用其物理大小绘制图像,因此无论显示设备) 分辨率 (每英寸点数如何,图像都将具有正确的英寸大小。 例如,假设图像的像素宽度为 216,水平分辨率为每英寸 72 点。 如果调用 DrawImageUnscaled 以在分辨率为每英寸 96 点的设备上绘制该图像,则呈现的图像的像素宽度将 (216/72) *96 = 288。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈