Поделиться через


Renderer.InkSpaceToPixel - метод (Graphics, Point%)

Обновлен: Ноябрь 2007

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

Пространство имен:  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
)

Параметры

Заметки

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

Примеры

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

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

Renderer Класс

Renderer - члены

InkSpaceToPixel - перегрузка

Microsoft.Ink - пространство имен

Renderer.PixelToInkSpace