変換用の Graphics オブジェクトを使用して、インク空間座標での位置を、ピクセル空間での位置に変換します。
名前空間 : Microsoft.Ink
アセンブリ : Microsoft.Ink (Microsoft.Ink.dll 内)
構文
'宣言
Public Sub InkSpaceToPixel ( _
g As Graphics, _
ByRef pt As Point _
)
'使用
Dim instance As Renderer
Dim g As Graphics
Dim pt As Point
instance.InkSpaceToPixel(g, pt)
public void InkSpaceToPixel(
Graphics g,
ref Point pt
)
public:
void InkSpaceToPixel(
Graphics^ g,
Point% pt
)
public void InkSpaceToPixel(
Graphics g,
/** @ref */Point pt
)
public function InkSpaceToPixel(
g : Graphics,
pt : Point
)
パラメータ
- g
型 : System.Drawing.Graphics
変換に使用する Graphics オブジェクト。これは、多くの場合 System.Windows.Forms.Control.CreateGraphics メソッドまたはイベント引数から取得されます。
- pt
型 : System.Drawing.Point%
ピクセル位置に変換するポイント。
解説
InkSpaceToPixel メソッドは、Renderer オブジェクトのオブジェクト変換を適用してビュー変換を適用し、HIMETRIC 単位からピクセル単位に変換します。
例
この例では、Ink オブジェクトの境界ボックスが取得され、この境界ボックスの中心が決定されます。次に、この中心はピクセル座標に変換され、Graphics オブジェクトがこれを使用して小さな赤色の円を描画します。
' get the ink bounds (ink space units)
Dim inkBounds As Rectangle = mInkOverlay.Ink.GetBoundingBox()
' create a Point in the center of the ink bounds (ink space units)
Dim centerPt As Point = _
New Point(inkBounds.X + (inkBounds.Width / 2), _
inkBounds.Y + (inkBounds.Height / 2))
Using g As Graphics = mInkOverlay.AttachedControl.CreateGraphics()
' convert to pixel space
mInkOverlay.Renderer.InkSpaceToPixel(g, centerPt)
' draw a small circle
g.DrawEllipse(Pens.Red, centerPt.X - 5, centerPt.Y - 5, 10, 10)
End Using
// get the ink bounds (ink space units)
Rectangle inkBounds = mInkOverlay.Ink.GetBoundingBox();
// create a Point in the center of the ink bounds (ink space units)
Point centerPt =
new Point(inkBounds.X + (inkBounds.Width / 2),
inkBounds.Y + (inkBounds.Height / 2));
using (Graphics g = mInkOverlay.AttachedControl.CreateGraphics())
{
// convert to pixel space
mInkOverlay.Renderer.InkSpaceToPixel(g, ref centerPt);
// draw a small circle
g.DrawEllipse(Pens.Red, centerPt.X - 5, centerPt.Y - 5, 10, 10);
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0