Renderer.InkSpaceToPixel Method
Renderer.InkSpaceToPixel Method |
Converts an array of locations in ink space coordinates to be in pixel space by using a Graphics object for the conversion.
Definition
Visual Basic .NET Public Sub InkSpaceToPixel( _
ByVal g As Graphics, _
ByRef pts As Point _
)C# public void InkSpaceToPixel(
Graphics g,
ref Point pts
);Managed C++ public: void InkSpaceToPixel(
Graphics *g,
Point **pts
);
Parameters
g System.Drawing.Graphics. The Graphics object to use for conversion. This generally comes from event arguments or from the System.Windows.Forms.Control.CreateGraphics method. pts System.Drawing.Point[]. The array of points to convert into pixel locations.
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
[C#]
This C# example takes the Ink from an InkOverlay object, theInkOverlay, and returns the bounding box of its associated Strokes collection, in pixel space.
using System.Drawing.Drawing2D; ... 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}; Graphics g = CreateGraphics(); // Convert from ink space to pixel space theInkOverlay.Renderer.InkSpaceToPixel(g, ref corners); g.Dispose(); return new Rectangle(corners[0], new Size(corners[1].X - corners[0].X, corners[1].Y - corners[0].Y)); }
[VB.NET]
This Microsoft® Visual Basic® .NET example takes the Ink from an InkOverlay object, theInkOverlay, and returns the bounding box of its associated Strokes collection, in pixel space.
Imports System.Drawing.Drawing2D ... 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(1) As Point corners(0) = theBoundingRectangle.Location corners(1) = New Point(theBoundingRectangle.Right, theBoundingRectangle.Bottom) Dim g As Graphics = CreateGraphics() 'Convert from ink space to pixel space theInkOverlay.Renderer.InkSpaceToPixel(g, corners) g.Dispose() Return New Rectangle(corners(0), _ New Size(corners(1).X - corners(0).X, corners(1).Y - corners(0).Y)) End Function
See Also