DynamicRenderer 类

定义

当用户移动触笔时,会在图面上绘制墨迹。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
继承
DynamicRenderer

示例

下面的示例演示如何将附加DynamicRenderer InkPresenter到。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)

注解

DynamicRendererStylusPlugIn从类继承, 并允许在用户将鼠标指针与 tablet 笔或其他指针设备一起移动时向表面呈现墨迹。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. 您可以使用在DynamicRenderer自定义控件上动态呈现墨迹, 或从DynamicRenderer继承以便在启用墨迹的InkCanvas元素 (如) 上实时执行自定义呈现。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.

当用户使用 tablet 笔输入墨迹时, 动态呈现是在独立于应用程序的用户界面线程的线程上完成的。Dynamic rendering is done on a thread separate from the application's user interface thread when the user inputs ink with a tablet pen. 使用鼠标时, 动态呈现是在 UI 线程上完成的。When a mouse is used, dynamic rendering is done on the UI thread.

备注

为了将此类引用为XAMLXAML元素, 你必须将System.Windows.Input.StylusPlugIns CLR 命名空间映射到前缀, 并使用DynamicRenderer该前缀来限定元素。In order to reference this class as a XAMLXAML element, you must map the System.Windows.Input.StylusPlugIns CLR namespace to a prefix, and use that prefix to qualify the DynamicRenderer element. 有关详细信息, 请参阅WPF xaml 的 XAML 命名空间和命名空间映射For details, see XAML Namespaces and Namespace Mapping for WPF XAML.

XAML 文本用法XAML Text Usage

此类通常不在 XAML 中使用。This class is not typically used in XAML.

构造函数

DynamicRenderer()

初始化 DynamicRenderer 类的新实例。Initializes a new instance of the DynamicRenderer class.

属性

DrawingAttributes

获取或设置可指定所呈现墨迹的外观的 DrawingAttributesGets or sets the DrawingAttributes that specifies the appearance of the rendered ink.

Element

获取其中附加了 UIElementStylusPlugInGets the UIElement to which the StylusPlugIn is attached.

(继承自 StylusPlugIn)
ElementBounds

获取元素的缓存边界。Gets the cached bounds of the element.

(继承自 StylusPlugIn)
Enabled

获取或设置 StylusPlugIn 是否处于活动状态。Gets or sets whether the StylusPlugIn is active.

(继承自 StylusPlugIn)
IsActiveForInput

获取 StylusPlugIn 是否可以接受输入。Gets whether the StylusPlugIn is able to accept input.

(继承自 StylusPlugIn)
RootVisual

获取 DynamicRenderer 的根 Visual。Gets the root visual for the DynamicRenderer.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetDispatcher()

返回呈现线程的 DispatcherReturns a Dispatcher for the rendering thread.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnAdded()

在将 DynamicRenderer 添加到元素中时发生。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()

DrawingAttributes 属性更改时发生。Occurs when the DrawingAttributes property changes.

OnEnabledChanged()

Enabled 属性更改时发生。Occurs when the Enabled property changes.

OnIsActiveForInputChanged()

IsActiveForInput 属性更改时发生。Occurs when the IsActiveForInput property changes.

OnRemoved()

在从元素中移除 StylusPlugIn 时发生。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)

当触笔接触数字化仪时,在应用程序 UI(用户界面)线程上发生。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)

当触笔移到数字化仪上时,在应用程序 UI(用户界面)线程上发生。Occurs on the application UI (user interface) thread when the tablet pen moves on the digitizer.

(继承自 StylusPlugIn)
OnStylusUp(RawStylusInput)

当用户将触笔从数字化仪上提起时,在笔线程上发生。Occurs on a pen thread when the user lifts the tablet pen from the digitizer.

OnStylusUpProcessed(Object, Boolean)

当用户将触笔从数字化仪上提起时,在应用程序 UI(用户界面)线程上发生。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()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于