Bagikan melalui


Renderer.InkSpaceToPixel Method (Graphics, array<Point[]%)

Converts an array of locations in ink space coordinates to be 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 pts As Point() _
)
'Usage
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 function InkSpaceToPixel(
    g : Graphics, 
    pts : 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, an InkOverlay object is passed to a method. The method returns the the bounding box of the associated Ink object in pixel space.

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

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