InkPresenter Class
Renders ink on a surface.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Ink rendering occurs in two ways: dynamic and static. Dynamic rendering occurs as ink is written to an inking surface: the stroke is rendered as it is being collected. Static rendering occurs after stroke data is collected and attached to a new stroke.
To render ink dynamically using the InkPresenter, attach the RootVisual property of a DynamicRenderer to the InkPresenter by using the AttachVisuals method. To statically render ink, add stroke objects to the Strokes property.
The following example programmatically creates a stroke and adds it to the InkPresenter. Only static rendering is done in this example, which assumes that the Loaded event is connected to the event handler, WindowLoaded.
public partial class Window1 : Window { InkPresenter inkPresenter1; public Window1() { InitializeComponent(); } private void WindowLoaded(object sender, RoutedEventArgs e) { inkPresenter1 = new InkPresenter(); this.Content = inkPresenter1; StylusPoint segment1Start = new StylusPoint(200, 110); StylusPoint segment1End = new StylusPoint(185, 150); StylusPoint segment2Start = new StylusPoint(185, 150); StylusPoint segment2End = new StylusPoint(135, 150); StylusPoint segment3Start = new StylusPoint(135, 150); StylusPoint segment3End = new StylusPoint(175, 180); StylusPoint segment4Start = new StylusPoint(175, 180); StylusPoint segment4End = new StylusPoint(160, 220); StylusPoint segment5Start = new StylusPoint(160, 220); StylusPoint segment5End = new StylusPoint(200, 195); StylusPoint segment6Start = new StylusPoint(200, 195); StylusPoint segment6End = new StylusPoint(240, 220); StylusPoint segment7Start = new StylusPoint(240, 220); StylusPoint segment7End = new StylusPoint(225, 180); StylusPoint segment8Start = new StylusPoint(225, 180); StylusPoint segment8End = new StylusPoint(265, 150); StylusPoint segment9Start = new StylusPoint(265, 150); StylusPoint segment9End = new StylusPoint(215, 150); StylusPoint segment10Start = new StylusPoint(215, 150); StylusPoint segment10End = new StylusPoint(200, 110); StylusPointCollection strokePoints = new StylusPointCollection(); strokePoints.Add(segment1Start); strokePoints.Add(segment1End); strokePoints.Add(segment2Start); strokePoints.Add(segment2End); strokePoints.Add(segment3Start); strokePoints.Add(segment3End); strokePoints.Add(segment4Start); strokePoints.Add(segment4End); strokePoints.Add(segment5Start); strokePoints.Add(segment5End); strokePoints.Add(segment6Start); strokePoints.Add(segment6End); strokePoints.Add(segment7Start); strokePoints.Add(segment7End); strokePoints.Add(segment8Start); strokePoints.Add(segment8End); strokePoints.Add(segment9Start); strokePoints.Add(segment9End); strokePoints.Add(segment10Start); strokePoints.Add(segment10End); Stroke newStroke = new Stroke(strokePoints); inkPresenter1.Strokes.Add(newStroke); } }
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.