.NET Framework - Inserting an image in a canvas

Asked By Anders Eriksson on 10-Feb-12 05:16 AM
I am using C#, VC2010 and WPF and I have a canvas[1] in which I want to
let the user be able to insert an image (*.png, *.jpg, *.bmp) and then
drag and drop it in the canvas.

I would also like for the user to be able to scale and rotate the image.

Do anyone has a sample on how to do this or suggestions on books that
teach you how to do 2d graphics?

// Anders

[1] Don't know if a canvas is the best solution, so any other ideas are
English is not my first language.
So any error or strangeness is due to the translation.
Please correct my English so that I may become better.

Peter Duniho replied to Anders Eriksson on 10-Feb-12 01:00 PM
I do not have any specific links.  But .NET does provide a number of
features that make this sort of thing relatively easy.  Both the Forms API
and the WPF API include mechanisms for drawing images and transforming

In the case of Forms, the PictureBox control can let you do scaling, but if
you want rotation you will have to draw the image itself.  In WPF, you can
simply add a new System.Windows.Controls.Image object to your window, and
set the VisualTransform property, which can include rotation, scaling,
translation, and skew (the usual matrix transformation properties).

Bob Powell has a site that is been around a long time; it is mainly focused
on the Forms API but it does have a lot of good introductory material.
This is a good page on which to start: