Renderer.InkSpaceToPixel 方法 (Graphics, array<Point[]%)
通过使用用于转换的 Graphics 对象,将墨迹空间 坐标中的位置数组转换到像素空间中。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Sub InkSpaceToPixel ( _
g As Graphics, _
ByRef pts As Point() _
)
用法
Dim instance As Renderer
Dim g As Graphics
Dim pts As Point()
instance.InkSpaceToPixel(g, pts)
public void InkSpaceToPixel(
Graphics g,
ref Point[] pts
)
public:
void InkSpaceToPixel(
Graphics^ g,
array<Point>^% pts
)
public void InkSpaceToPixel(
Graphics g,
/** @ref */Point[] pts
)
public function InkSpaceToPixel(
g : Graphics,
pts : Point[]
)
参数
- g
类型:System.Drawing.Graphics
要用于转换的 Graphics 对象。该对象通常来自于事件参数或 System.Windows.Forms.Control.CreateGraphics 方法。
- pts
类型:array<System.Drawing.Point[]%
要转换为像素位置的点的数组。
备注
InkSpaceToPixel 方法应用 Renderer 对象的对象变换,再应用视图变换,然后从 HIMETRIC 转换到像素单位。
示例
此示例将 InkOverlay 对象传递给一个方法。该方法返回像素空间中关联的 Ink 对象的边界框。
Public Function GetInkBoundsInPixels(ByVal theInkOverlay As InkOverlay) As Rectangle
' Copy the bounding rectangle in ink space dimensions
Dim theBoundingRectangle As Rectangle = theInkOverlay.Ink.GetBoundingBox()
' Get the top left and bottom right points
Dim corners() As Point = _
{ _
theBoundingRectangle.Location, _
theBoundingRectangle.Location + theBoundingRectangle.Size _
}
Using g As Graphics = mInkOverlay.AttachedControl.CreateGraphics()
' Convert from ink space to pixel space
theInkOverlay.Renderer.InkSpaceToPixel(g, corners)
End Using
Return New Rectangle(corners(0), _
New Size(corners(1).X - corners(0).X, corners(1).Y - corners(0).Y))
End Function
public Rectangle GetInkBoundsInPixels(InkOverlay theInkOverlay)
{
// Copy the bounding rectangle in ink space dimensions
Rectangle theBoundingRectangle = theInkOverlay.Ink.GetBoundingBox();
// Get the top left and bottom right points
Point[] corners = new Point[2]
{
theBoundingRectangle.Location,
theBoundingRectangle.Location + theBoundingRectangle.Size
};
using (Graphics g = mInkOverlay.AttachedControl.CreateGraphics())
{
// Convert from ink space to pixel space
theInkOverlay.Renderer.InkSpaceToPixel(g, ref corners);
}
return new Rectangle(corners[0],
new Size(corners[1].X - corners[0].X, corners[1].Y - corners[0].Y));
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0