Graphics.ScaleTransform Method (Single, Single)

 

Applies the specified scaling operation to the transformation matrix of this Graphics by prepending it to the object's transformation matrix.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

member ScaleTransform : 
        sx:float32 *
        sy:float32 -> unit

Parameters

sx
Type: System.Single

Scale factor in the x direction.

sy
Type: System.Single

Scale factor in the y direction.

The scaling operation consists of multiplying the transformation matrix by a diagonal matrix whose elements are (sx, sy, 1). This method prepends the transformation matrix of the Graphics by the scaling matrix.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  • Rotates the world transformation matrix of the Windows Form by 30 degrees.

  • Scales that matrix by a factor of 3 in the x direction and a factor of 1 in the y direction by prepending the scaling transformation.

  • Draws a scaled, rotated rectangle with a blue pen.

The result is still a rectangle.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: