DynamicRenderer 类

定义

当用户移动平板电脑笔时,在图面上绘制墨迹。

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

示例

以下示例演示如何将 a DynamicRenderer 附加到 .InkPresenter 若要创建动态呈现墨迹的控件,请参阅 “创建墨迹输入控件”。

// 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)

注解

DynamicRenderer 类继承自 StylusPlugIn 该类,并允许墨迹呈现到图面,因为用户使用平板电脑笔或其他指向设备移动鼠标指针。 可以使用自定义 DynamicRenderer 控件动态呈现墨迹,也可以从 DynamicRenderer 中继承来对已启用墨迹的元素(如 InkCanvas)实时执行自定义呈现。

当用户使用平板电脑笔输入墨迹时,动态呈现在独立于应用程序的用户界面线程的线程上完成。 使用鼠标时,动态呈现在 UI 线程上完成。

Note

若要将此类引用为 XAML 元素,必须将 CLR 命名空间映射到 System.Windows.Input.StylusPlugIns 前缀,并使用该前缀限定 DynamicRenderer 该元素。 有关详细信息,请参阅 WPF XAML 的 XAML 命名空间和命名空间映射

XAML 文本用法

此类通常用于 XAML。

构造函数

名称 说明
DynamicRenderer()

初始化 DynamicRenderer 类的新实例。

属性

名称 说明
DrawingAttributes

获取或设置 DrawingAttributes 指定呈现墨迹的外观。

Element

UIElement获取所附加到的StylusPlugIn项。

(继承自 StylusPlugIn)
ElementBounds

获取元素的缓存边界。

(继承自 StylusPlugIn)
Enabled

获取或设置活动 StylusPlugIn 状态。

(继承自 StylusPlugIn)
IsActiveForInput

获取是否可以 StylusPlugIn 接受输入。

(继承自 StylusPlugIn)
RootVisual

获取 . 的 DynamicRenderer根视觉对象。

方法

名称 说明
Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetDispatcher()

返回呈现线程的一个 Dispatcher

GetHashCode()

用作默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object的浅表副本。

(继承自 Object)
OnAdded()

在将元素 DynamicRenderer 添加到元素时发生。

OnDraw(DrawingContext, StylusPointCollection, Geometry, Brush)

实时绘制墨迹,使其似乎从平板电脑笔或其他指向设备“流动”。

OnDrawingAttributesReplaced()

属性 DrawingAttributes 更改时发生。

OnEnabledChanged()

属性 Enabled 更改时发生。

OnIsActiveForInputChanged()

属性 IsActiveForInput 更改时发生。

OnRemoved()

从元素中删除该元素时 StylusPlugIn 发生。

OnStylusDown(RawStylusInput)

当平板电脑笔触摸数字化器时,在笔线程池中的线程上发生。

OnStylusDownProcessed(Object, Boolean)

当平板电脑笔触摸数字化器时,在应用程序 UI(用户界面)线程上发生。

OnStylusEnter(RawStylusInput, Boolean)

当光标进入元素边界时,在笔线程上发生。

OnStylusLeave(RawStylusInput, Boolean)

当光标离开元素边界时,在笔线程上发生。

OnStylusMove(RawStylusInput)

当平板电脑笔在数字化器上移动时,在笔线程上发生。

OnStylusMoveProcessed(Object, Boolean)

当平板电脑笔在数字化器上移动时,在应用程序 UI(用户界面)线程上发生。

(继承自 StylusPlugIn)
OnStylusUp(RawStylusInput)

当用户从数字化器中抬起平板电脑笔时,在笔线程上发生。

OnStylusUpProcessed(Object, Boolean)

当用户从数字化器中抬起平板电脑笔时,在应用程序 UI(用户界面)线程上发生。

Reset(StylusDevice, StylusPointCollection)

清除当前笔划的呈现并重新绘制它。

ToString()

返回一个表示当前对象的字符串。

(继承自 Object)

适用于