Point.Offset 方法 (Int32, Int32) &&Point.Offset 方法 (Point)

来源:互联网 发布:还珠格格知画扮演者 编辑:程序博客网 时间:2024/05/23 21:29

1.Point.Offset 方法 (Int32, Int32)

将此 Point 平移指定的量。

命名空间:  System.Drawing
程序集:  System.Drawing(在 System.Drawing.dll 中)

语法

C#
public void Offset(int dx,int dy)

参数
dx
类型:System..::.Int32

偏移 X 坐标的量。

dy
类型:System..::.Int32

偏移 Y 坐标的量。

平台

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 for Smartphone, Windows Mobile for Pocket PC

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。

版本信息

.NET Framework

受以下版本支持:3.5、3.0 SP1、3.0、2.0 SP1、2.0、1.1、1.0

.NET Compact Framework

受以下版本支持:3.5、2.0、1.0

请参见

参考

Point 结构
Point 成员
Offset 重载
System.Drawing 命名空间
2.Point.Offset 方法 (Point)

将此 Point 平移指定的 Point。

命名空间:  System.Drawing
程序集:  System.Drawing(在 System.Drawing.dll 中)

语法

C#
public void Offset(Point p)

参数
p
类型:System.Drawing.Point

用于使此 Point 发生偏移的 Point。

备注

此方法将此 Point 的 X 和Y 值分别调整为此 Point 的 X 和 Y 值与 p 之和。

示例

下面的示例显示如何使用 Offset 方法。若要运行此示例,请将其粘贴到 Windows 窗体中。处理窗体的 Paint 事件并从 Paint 事件处理方法中调用OffsetPoint 方法,同时将 e 作为 PaintEventArgs 传递。

C# “复制”图像复制代码
private void OffsetPoint(PaintEventArgs e){    Point point1 = new Point(10, 10);    point1.Offset(50, 0);    Point point2 = new Point(250, 10);    e.Graphics.DrawLine(Pens.Red, point1, point2);}

平台

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

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。

版本信息

.NET Framework

受以下版本支持:3.5、3.0 SP1、3.0、2.0 SP1、2.0

请参见

参考

Point 结构
Point 成员
Offset 重载
System.Drawing 命名空间


0 0