AttachVisuals Method

InkPresenter.AttachVisuals Method (Visual, DrawingAttributes)

 

Attaches the visual of a DynamicRenderer to an InkPresenter.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Public Sub AttachVisuals (
	visual As Visual,
	drawingAttributes As DrawingAttributes
)

Parameters

visual
Type: System.Windows.Media.Visual

The visual of a DynamicRenderer.

drawingAttributes
Type: System.Windows.Ink.DrawingAttributes

The DrawingAttributes that specifies the appearance of the dynamically rendered ink.

Exception Condition
InvalidOperationException

visual is already attached to a visual tree.

Attach the visual of a DynamicRenderer to the InkPresenter to dynamically render ink on your control.

The following example demonstrates how to attach the visual and DrawingAttributes of a DynamicRenderer to an InkPresenter.

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

.NET Framework
Available since 3.0
Return to top
Show:
© 2016 Microsoft