Filip Ekberg
Filip Ekberg

Reputation: 36327

WPF Custom Shapes

I was looking over old MIX-videos from 2007 and saw a nice presentation showing Hand Drawn Shapes in WPF. My question is if these exist in the standard shipped package or if i have to create these myself.

I imagine that I have to create them, so here comes the "real" programming question: How do you start when you want to create a "hand drawn"-looking shape which is "portable"? I want to be able to re-use as much code as possible for Rectangle, Elipse, Line etc.

Upvotes: 1

Views: 1785

Answers (3)

JowSithm
JowSithm

Reputation: 36

I think this may be what you're looking for: Hand drawn shapes is near the bottom of the page.

Upvotes: 2

gbc
gbc

Reputation: 8565

Draw the shape in Expression Designer and then choose "Export..." as XAML. When the export dialog appears, choose "Resource Dictionary" as the document format, then you can switch to the XAML tab and copy the code from the dialog box into a Resource Dictionary in your Visual Studio project. Now you have a DrawingBrush that you can use to place your shapes anywhere in your application.

Upvotes: 0

Pete OHanlon
Pete OHanlon

Reputation: 9146

When I want to draw a custom shape, I use a tool like Expression Designer, Expression Blend, Adobe Fireworks or Illustrator to design the shape (there's a plugin for Fireworks and one for Illustrator that saves vectors out to XAML). This takes care of the hard part of laying things out in XAML, and this shape is reusable later on.

Upvotes: 0

Related Questions