変換用の 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