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


InkOverlay.Renderer - свойство

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

Gets or sets the Renderer object that is used to draw ink.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
<BrowsableAttribute(False)> _
Public Property Renderer As Renderer
'Применение
Dim instance As InkOverlay
Dim value As Renderer

value = instance.Renderer

instance.Renderer = value
[BrowsableAttribute(false)]
public Renderer Renderer { get; set; }
[BrowsableAttribute(false)]
public:
property Renderer^ Renderer {
    Renderer^ get ();
    void set (Renderer^ value);
}
/** @property */
/** @attribute BrowsableAttribute(false) */
public Renderer get_Renderer()
/** @property */
/** @attribute BrowsableAttribute(false) */
public  void set_Renderer(Renderer value)
public function get Renderer () : Renderer
public function set Renderer (value : Renderer)

Значение свойства

Тип: Microsoft.Ink.Renderer
The Renderer object that is used to draw ink.

Примеры

The following example shows how to use an alternate Renderer object to provide a zoomed view for either an InkCollector object, an InkOverlay object,or an InkPicture object.

Prior to using the alternate Renderer object, it is initialized to provide the zooming transformation desired, and the original Renderer object is saved in order to return to the default rendering behavior.

zoomRenderer = New Renderer()
Dim zoomBy2 As Matrix = New Matrix()
zoomBy2.Scale(2, 2)
zoomRenderer.SetObjectTransform(zoomBy2)
' mInkObject can be InkCollector, InkOverlay, or InkPicture
origRenderer = mInkObject.Renderer
zoomRenderer = new Renderer();
Matrix zoomBy2 = new Matrix();
zoomBy2.Scale(2, 2);
zoomRenderer.SetObjectTransform(zoomBy2);
// mInkObject can be InkCollector, InkOverlay, or InkPicture
origRenderer = mInkObject.Renderer;

In response to the CheckChanged event of a CheckBox object, the appropriate Renderer object is assigned, and the ink area is redrawn.

If DirectCast(sender, CheckBox).Checked Then
    ' mInkObject can be InkCollector, InkOverlay, or InkPicture
    mInkObject.Renderer = zoomRenderer
Else
    mInkObject.Renderer = origRenderer
End If
' refresh to show the transformed ink. In production code
' you should invalidate only the necessary area that is 
' affected by the transformation but for simplicity here
' we will invalidate the entire form
Me.Refresh()
if (((CheckBox)sender).Checked)
{
    // mInkObject can be InkCollector, InkOverlay, or InkPicture
    mInkObject.Renderer = zoomRenderer;
}
else
{
    mInkObject.Renderer = origRenderer;
}
// refresh to show the transformed ink. In production code
// you should invalidate only the necessary area that is 
// affected by the transformation but for simplicity here
// we will invalidate the entire form
this.Refresh();

The following example demonstates the use of an Renderer object to convert a rectangle expressed in ink space coordinates to one expressed in pixel coordinates.

Private Function InkSpaceToPixelRectangle(ByVal inkRectangle As Rectangle) As Rectangle
    ' Get points for corners of rectangle
    Dim leftTop As Point = inkRectangle.Location
    Dim rightBottom As Point = New Point(inkRectangle.Right, inkRectangle.Bottom)

    ' Convert using a Renderer object
    Dim tGraphics As Graphics = CreateGraphics()
    Dim tRenderer As Renderer = New Renderer()
    tRenderer.InkSpaceToPixel(tGraphics, leftTop)
    tRenderer.InkSpaceToPixel(tGraphics, rightBottom)

    ' Clean up
    tGraphics.Dispose()

    ' Return new rectangle
    Return New Rectangle(leftTop, New Size(rightBottom.X - leftTop.X, rightBottom.Y - leftTop.Y))
End Function
private Rectangle InkSpaceToPixelRectangle(Rectangle inkRectangle)
{
    // Get points for corners of rectangle
    Point leftTop = inkRectangle.Location;
    Point rightBottom = new Point(inkRectangle.Right, inkRectangle.Bottom);

    // Convert using a Renderer object
    Graphics tGraphics = CreateGraphics();
    Renderer tRenderer = new Renderer();
    tRenderer.InkSpaceToPixel(tGraphics, ref leftTop);
    tRenderer.InkSpaceToPixel(tGraphics, ref rightBottom);

    // Clean up
    tGraphics.Dispose();

    // Return new rectangle
    return new Rectangle(leftTop, new Size(rightBottom.X - leftTop.X, rightBottom.Y - leftTop.Y));
}

Платформы

Windows Vista

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

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

.NET Framework

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

См. также

Ссылки

InkOverlay Класс

InkOverlay - члены

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

Renderer