How should i draw text and shapes in wpf and C#?

Posted by peterhu on Stack Overflow See other posts from Stack Overflow or by peterhu
Published on 2010-06-11T23:03:35Z Indexed on 2010/06/11 23:22 UTC
Read the original article Hit count: 171

Filed under:
|

I want to do basic WPF graphics, i.e. rectangles, lines, circles and text.

When should I use Drawing and when should I use a DrawingVisual?

I have some code that uses Drawing and I render those to a DrawingImage and display that in an image control. Is this the right way? I could not see how to add text to a drawing. I had trouble positioning it too. Should I be rendering to a Canvas?

I have some code that uses DrawingVisual and writes to a DrawingContext. That is like WinForms. Is this the recommended way?

Do you have any high level advice on which APIs to use for basic graphics and labels? Will they options work on Silver Light and Desktop?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf