views:

963

answers:

3

Hi there,

I need to write a simple WPF program to draw a Bezier curve, but I have to draw it programmatically since I need to allow user to modify the shape interactively.

Any code sample to do this task is highly appreciated!

Thanks,

Mike

A: 

Here is a decent tutorial from Cal Fullerton with coding examples.

pdemarest
+3  A: 
Thomas Levesque
Nice link. Note that it requires .NET 3.5 SP1 (but only insomuch as to support StringFormat which can be removed to get it running).
Drew Noakes
A: 

Have a look at the Path Markup Syntax to get a feel for the raw drawing primitives available to you in WPF.

You could use either cubic or quadratic Bezier curves (each has a smoothed version too) depending on how you want to define the control points.

As for rendering the control points on screen and allowing the user to drag them about you might like to look into adorners and possibly the Thumb class.

Drew Noakes