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 已附加至圖形化樹狀結構。

範例

下列範例示範如何將 視覺效果和 的 DrawingAttributes 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 視覺效果附加至 , InkPresenter 以動態呈現控制項上的筆跡。

適用於