Redigera

Dela via


DynamicRenderer Class

Definition

Draws ink on a surface as the user moves the tablet pen.

public ref class DynamicRenderer : System::Windows::Input::StylusPlugIns::StylusPlugIn
public class DynamicRenderer : System.Windows.Input.StylusPlugIns.StylusPlugIn
type DynamicRenderer = class
    inherit StylusPlugIn
Public Class DynamicRenderer
Inherits StylusPlugIn
Inheritance
DynamicRenderer

Examples

The following example demonstrates how to attach a DynamicRenderer to an InkPresenter. To create a control that dynamically renders ink, see Creating an Ink Input Control.

// Create a DrawingAttributes to use for the 
// DynamicRenderer.
DrawingAttributes inkDA = new DrawingAttributes();
inkDA.Width = 5;
inkDA.Height = 5;
inkDA.Color = Colors.Purple;

// Add a dynamic renderer plugin that 
// draws ink as it "flows" from the stylus
DynamicRenderer dynamicRenderer1 = new DynamicRenderer();
dynamicRenderer1.DrawingAttributes = inkDA;

this.StylusPlugIns.Add(dynamicRenderer1);
inkPresenter1.AttachVisuals(dynamicRenderer1.RootVisual,
    dynamicRenderer1.DrawingAttributes);
' Create a DrawingAttributes to use for the 
' DynamicRenderer.
Dim inkDA As New DrawingAttributes()
inkDA.Width = 5
inkDA.Height = 5
inkDA.Color = Colors.Purple

' Add a dynamic renderer plugin that 
' draws ink as it "flows" from the stylus
Dim dynamicRenderer1 As New DynamicRenderer()
dynamicRenderer1.DrawingAttributes = inkDA

Me.StylusPlugIns.Add(dynamicRenderer1)
inkPresenter1.AttachVisuals(dynamicRenderer1.RootVisual, dynamicRenderer1.DrawingAttributes)

Remarks

The DynamicRenderer class inherits from the StylusPlugIn class, and allows ink to be rendered to a surface as the user moves the mouse pointer with a tablet pen or other pointing device. You can use the DynamicRenderer to dynamically render ink on a custom control, or inherit from DynamicRenderer to perform custom rendering in real time on an ink-enabled element, such as the InkCanvas.

Dynamic rendering is done on a thread separate from the application's user interface thread when the user inputs ink with a tablet pen. When a mouse is used, dynamic rendering is done on the UI thread.

Note

In order to reference this class as a XAML element, you must map the System.Windows.Input.StylusPlugIns CLR namespace to a prefix, and use that prefix to qualify the DynamicRenderer element. For details, see XAML Namespaces and Namespace Mapping for WPF XAML.

XAML Text Usage

This class is not typically used in XAML.

Constructors

DynamicRenderer()

Initializes a new instance of the DynamicRenderer class.

Properties

DrawingAttributes

Gets or sets the DrawingAttributes that specifies the appearance of the rendered ink.

Element

Gets the UIElement to which the StylusPlugIn is attached.

(Inherited from StylusPlugIn)
ElementBounds

Gets the cached bounds of the element.

(Inherited from StylusPlugIn)
Enabled

Gets or sets whether the StylusPlugIn is active.

(Inherited from StylusPlugIn)
IsActiveForInput

Gets whether the StylusPlugIn is able to accept input.

(Inherited from StylusPlugIn)
RootVisual

Gets the root visual for the DynamicRenderer.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetDispatcher()

Returns a Dispatcher for the rendering thread.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnAdded()

Occurs when the DynamicRenderer is added to an element.

OnDraw(DrawingContext, StylusPointCollection, Geometry, Brush)

Draws the ink in real-time so it appears to "flow" from the tablet pen or other pointing device.

OnDrawingAttributesReplaced()

Occurs when the DrawingAttributes property changes.

OnEnabledChanged()

Occurs when the Enabled property changes.

OnIsActiveForInputChanged()

Occurs when the IsActiveForInput property changes.

OnRemoved()

Occurs when the StylusPlugIn is removed from an element.

OnStylusDown(RawStylusInput)

Occurs on a thread in the pen thread pool when the tablet pen touches the digitizer.

OnStylusDownProcessed(Object, Boolean)

Occurs on the application UI (user interface) thread when the tablet pen touches the digitizer.

OnStylusEnter(RawStylusInput, Boolean)

Occurs on a pen thread when the cursor enters the bounds of an element.

OnStylusLeave(RawStylusInput, Boolean)

Occurs on a pen thread when the cursor leaves the bounds of an element.

OnStylusMove(RawStylusInput)

Occurs on a pen thread when the tablet pen moves on the digitizer.

OnStylusMoveProcessed(Object, Boolean)

Occurs on the application UI (user interface) thread when the tablet pen moves on the digitizer.

(Inherited from StylusPlugIn)
OnStylusUp(RawStylusInput)

Occurs on a pen thread when the user lifts the tablet pen from the digitizer.

OnStylusUpProcessed(Object, Boolean)

Occurs on the application UI (user interface) thread when the user lifts the tablet pen from the digitizer.

Reset(StylusDevice, StylusPointCollection)

Clears rendering on the current stroke and redraws it.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to