System.Drawing.Graphics.MultiplyTransform C# (CSharp) Method

MultiplyTransform() public method

public MultiplyTransform ( Matrix matrix ) : void
matrix Matrix
return void
        public void MultiplyTransform(Matrix matrix)
        {
            MultiplyTransform (matrix, MatrixOrder.Prepend);
        }

Same methods

Graphics::MultiplyTransform ( Matrix matrix, MatrixOrder order ) : void

Usage Example

Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="pen"></param>
        /// <param name="bounds"></param>
        /// <param name="cornerRadius"></param>
        public static void DrawImage(this Graphics graphics, Image image, RectangleF bound, float rot)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }

            // store state
            var transform = graphics.Transform;

            // reset
            graphics.ResetTransform();

            //move rotation point to center of image
            graphics.TranslateTransform(bound.X + bound.Width / 2, bound.Y + bound.Height / 2);

            //rotate
            graphics.RotateTransform((float)(rot * 180 / Math.PI));

            //move image back
            graphics.TranslateTransform(-bound.X - bound.Width / 2, -bound.Y - bound.Height / 2);

            //draw passed in image onto graphics object
            graphics.MultiplyTransform(transform);

            // draw image
            graphics.DrawImage(image, bound);

            // restore state
            graphics.Transform = transform;
        }
All Usage Examples Of System.Drawing.Graphics::MultiplyTransform