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