Pen::SetTransform method (gdipluspen.h)

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

Syntax

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

Parameters

[in] matrix

Type: const Matrix*

Pointer to a Matrix object that specifies the world transformation.

Return value

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.

Remarks

This method ignores the translation portion of the Matrix object.

Examples

The following example creates a scale matrix and a Pen object, and then draws a rectangle. The code then scales the pen by the matrix and draws a second rectangle.

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

   Matrix matrix(20, 0, 0, 10, 0, 0);  // scale

   // Create a pen, and use it to draw a rectangle.
   Pen pen(Color(255, 0, 0, 255), 2);
   graphics.DrawRectangle(&pen, 10, 50, 150, 100);

   // Scale the pen width by a factor of 20 in the horizontal 
   // direction and a factor of 10 in the vertical direction.
   pen.SetTransform(&matrix);

   // Draw a rectangle with the transformed pen.
   graphics.DrawRectangle(&pen, 200, 50, 150, 100);
}

Requirements

   
Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdipluspen.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Coordinate Systems and Transformations

Matrix

Pen

Pen::GetTransform

Pen::MultiplyTransform

Pen::ResetTransform

Pen::RotateTransform

Pen::ScaleTransform

Transformations