Prev | Current Page 234 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"

However, the InkCanvas works with the mouse in the
same way as it works with the stylus. Thus, a user can draw lines or select and manipulate
elements in the InkCanvas using the mouse.
The InkCanvas actually holds two collections of child content. The familiar Children
collection holds arbitrary elements, just as with the Canvas. Each element can be positioned
based on the Top, Left, Bottom, and Right properties. The Strokes collection holds
System.Windows.Ink.Stroke objects, which represent graphical input that the user has drawn
in the InkCanvas. Each line or curve that the user draws becomes a separate Stroke object.
Thanks to these dual collections, you can use the InkCanvas to let the user annotate content
(stored in the Children collection) with strokes (stored in the Strokes collection).
For example, Figure 4-18 shows an InkCanvas that contains a picture that has been annotated
with extra strokes. Here??™s the markup for the InkCanvas in this example, which defines
the image:
EditingMode="Ink">
Width="287" Height="319">

CHAPTER 4 n LAYOUT 109
The strokes are drawn at runtime by the user.
Figure 4-18. Adding strokes in an InkCanvas
The InkCanvas can be used in some significantly different ways, depending on the value
you set for the InkCanvas.


Pages:
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246