次の方法で共有


Renderer.InkSpaceToPixel メソッド (Graphics, Point%)

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

パラメータ

解説

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

参照

参照

Renderer クラス

Renderer メンバ

InkSpaceToPixel オーバーロード

Microsoft.Ink 名前空間

Renderer.PixelToInkSpace