DynamicRenderer 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当用户移动平板电脑笔时,在图面上绘制墨迹。
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
- 继承
示例
以下示例演示如何将 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根视觉对象。 |