Prev | Current Page 648 | Next

Matthew MacDonald

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

In other words, you can
place a shape in any of the layout containers you learned about in Chapter 4. (Although
the Canvas is obviously the most useful container because it allows you to place shapes
at specific coordinates, which is important when you??™re building a complex drawing out
of multiple pieces.)
C H A P T E R 1 3
372 CHAPTER 13 n SHAPES, TRANSFORMS, AND BRUSHES
??? Shapes support the same events as other elements. That means you don??™t need to go
to any extra work to deal with focus, key presses, mouse movements, and mouse clicks.
You can use the same set of events you??™d use with any element, and you have the same
support for tooltips, context menus, and drag-and-drop operations.
This model is dramatically different than those in earlier user interface technologies, such
as Windows Forms. Those frameworks do most of their work using the traditional windowing
model (through User32), which would be incredibly inefficient if applied to pieces of graphical
content, such as individual lines and squares. Additionally, the window model requires that
each element ???own??? a small section of screen real estate, which makes it difficult to add transparency
and use antialiasing around the edges of a nonrectangular shape.
Because of these limitations, older frameworks use the lower-level GDI/GDI+ model for
custom drawing.


Pages:
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660