O'Reilly logo

Sams Teach Yourself WPF in 24 Hours by Christopher Bennage, Rob Eisenberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Drawing with Shapes

What You’ll Learn in This Hour:

  • Using Shapes

  • Drawing with the Path element

  • Understanding stroke and fill

  • Working with complex shapes

Just like the rest of WPF, the API for 2D drawing is both extensive and powerful. Our goal in this hour is to equip you with the basics you need to start working with WPF quickly, as well as providing a foundation for learning if your projects have a need to go deeper.

Drawing Basic Shapes

The WPF has a number of basic shapes built in. The shapes are

  • Line

  • Polyline

  • Polygon

  • Rectangle

  • Ellipse

  • Path

All these classes live in the namespace System.Windows.Shapes.

Lines and Strokes

The best way to understand how these shapes work is to see them in action. Let’s create a simple project for the purpose of understanding ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required