InkPresenter.AttachVisuals(Visual, DrawingAttributes) 方法

定义

DynamicRenderer 的视觉效果附加到 InkPresenter

public:
 void AttachVisuals(System::Windows::Media::Visual ^ visual, System::Windows::Ink::DrawingAttributes ^ drawingAttributes);
public void AttachVisuals (System.Windows.Media.Visual visual, System.Windows.Ink.DrawingAttributes drawingAttributes);
member this.AttachVisuals : System.Windows.Media.Visual * System.Windows.Ink.DrawingAttributes -> unit
Public Sub AttachVisuals (visual As Visual, drawingAttributes As DrawingAttributes)

参数

visual
Visual

DynamicRenderer 的视觉效果。

drawingAttributes
DrawingAttributes

用于指定动态呈现的墨迹的外观的 DrawingAttributes

例外

visual 已附加到视觉效果树。

示例

以下示例演示如何将 的DynamicRendererInkPresenter视觉对象 和 DrawingAttributes 附加到 。

// 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 视觉对象附加到 , InkPresenter 以在 控件上动态呈现墨迹。

适用于