Type Default Value Read Only Static Description
XTransform Identity Yes No A geometric transformation for placing the object on the canvas.

The object coordinates are altered by this transformation, once it is drawn on the canvas. Use this property to rotate, translate, scale the object and so forth.

See Also



The following code will rotate an image by 45 degrees and scale it to twice its size. To make sure the image is fully visible we also need to translate it by its height times the sin of 45 degrees (45 * PI/180 in radians). The translation must take place before scaling, obviously.

[C#]Canvas canvas = new Canvas();
XImage image = XImage.FromFile(Server.MapPath("rez/boat.gif"));
DrawOptions drawOpts = new DrawOptions();
drawOpts.Transform.Rotate(45, 0, 0);
drawOpts.Transform.Translate(image.Height * Math.Sin(45 * Math.PI / 180), 0);
drawOpts.Transform.Magnify(2, 2, 0, 0);
canvas.DrawImage(image, drawOpts);

[Visual Basic]Dim canvas As New Canvas()
Dim image As XImage = XImage.FromFile(Server.MapPath("rez/boat.gif"))
Dim drawOpts As New DrawOptions()
drawOpts.Transform.Rotate(45, 0, 0)
drawOpts.Transform.Translate(image.Height * Math.Sin(45 * Math.PI / 180), 0)
drawOpts.Transform.Magnify(2, 2, 0, 0)
canvas.DrawImage(image, drawOpts)