Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Graphics.SetTransform method

Applies to: desktop apps only

The Graphics::SetTransform method sets the world transformation of this Graphics object.

Syntax

Status SetTransform(
  [in]  const Matrix *matrix
);

Parameters

matrix [in]

Type: const Matrix*

Pointer to a Matrix object that specifies the world transformation.

Return value

Type:

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Examples

The following example creates a rotation matrix and passes the address of that matrix to the Graphics::SetTransform method of a Graphics object. The code calls the Graphics::DrawRectangle method of the Graphics object to draw a rotated rectangle.


VOID Example_SetTransform(HDC hdc)
{
   Graphics graphics(hdc);

   // Create a rotation matrix.
   Matrix transformMatrix;
   transformMatrix.Rotate(45.0f);

   // Set the transformation matrix of the Graphics object.
   graphics.SetTransform(&transformMatrix);

   // Draw a rotated rectangle.
   Pen pen(Color(255, 0, 0, 0));
   graphics.DrawRectangle(&pen, 120, 0, 100, 50);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics
Graphics::GetTransform
Matrix
MatrixOrder
Graphics::MultiplyTransform
Graphics::ResetTransform
Graphics::RotateTransform
Graphics::ScaleTransform
Graphics::TransformPoints
Graphics::TranslateTransform
Transformations
Coordinate Systems and Transformations

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2015 Microsoft