Bagikan melalui


Renderer.InkSpaceToPixel Method (Graphics, Point%)

Converts a location in ink space coordinates to be a location in pixel space by using a Graphics object for the conversion.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Sub InkSpaceToPixel ( _
    g As Graphics, _
    ByRef pt As Point _
)
'Usage
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 function InkSpaceToPixel(
    g : Graphics, 
    pt : Point
)

Parameters

Remarks

The InkSpaceToPixel method applies the object transform of the Renderer object, applies the view transform, and then converts from HIMETRIC to pixel units.

Examples

In this example, the bounding box of an Ink object is obtained, and the center of the bounding box is determined. The center point is then converted to pixel coordinates and used by the Graphics object to draw a small red circle.

' 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);
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Renderer Class

Renderer Members

InkSpaceToPixel Overload

Microsoft.Ink Namespace

Renderer.PixelToInkSpace