Strokes.Transform Method

Strokes.Transform Method

Applies a linear transformation to a Strokes collection.

Definition

Visual Basic .NET Public Sub Transform( _
ByVal inkTransform As Matrix _
)
C# public void Transform(
Matrix inkTransform
);
Managed C++ public: void Transform(
Matrix *inkTransform
);

Parameters

inkTransform System.Drawing.Drawing2D.Matrix. The System.Drawing.Drawing2D.Matrix Leave Site transform to use on the Strokes collection.

Remarks

The transformation applies to the points, but not the pen width. To set a value that includes the pen width in the transformation, use the Transform(Matrix,Boolean) overload of this method.

The linear transform can represent scaling, rotation, translation, and combinations of transformations.

Examples

[C#]

This C# example rotates the Strokes collection attached to an InkOverlay object, theInkOverlay, by 180 degrees around the center of the Strokes collection's bounding box.

using System.Drawing.Drawing2D;
//...
Matrix inkTransform = new Matrix();
Rectangle inkBounds = theInkOverlay.Ink.Strokes.GetBoundingBox();
PointF center = new PointF(0.5f * (inkBounds.Left + inkBounds.Right),
                           0.5f * (inkBounds.Top + inkBounds.Bottom));
// Translate to center of bounding box
inkTransform.Translate(center.X, center.Y);
// Rotate by 180 degrees
inkTransform.Rotate(180f);
// Translate back
inkTransform.Translate(-center.X, -center.Y);
// Transform strokes
theInkOverlay.Ink.Strokes.Transform(inkTransform);
                

[VB.NET]

This Microsoft® Visual Basic® .NET example rotates the Strokes collection attached to an InkOverlay object, theInkOverlay, by 180 degrees around the center of the Strokes collection's bounding box.

Imports System.Drawing.Drawing2D
'...
Dim inkTransform As New Matrix()
Dim inkBounds As Rectangle = theInkOverlay.Ink.Strokes.GetBoundingBox()
Dim center As New PointF(0.5F * (inkBounds.Left + inkBounds.Right), _
                         0.5F * (inkBounds.Top + inkBounds.Bottom))
'Translate to center of bounding box
inkTransform.Translate(center.X, center.Y)
'Rotate by 180 degrees
inkTransform.Rotate(180.0F)
'Translate back
inkTransform.Translate(-center.X, -center.Y)
'Transform strokes
theInkOverlay.Ink.Strokes.Transform(inkTransform)
                

See Also