Поделиться через


Stroke.Transform - метод (Matrix)

Обновлен: Ноябрь 2007

Applies a linear transformation to a Stroke object, not affecting the pen width.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Sub Transform ( _
    inkTransform As Matrix _
)
'Применение
Dim instance As Stroke
Dim inkTransform As Matrix

instance.Transform(inkTransform)
public void Transform(
    Matrix inkTransform
)
public:
void Transform(
    Matrix^ inkTransform
)
public void Transform(
    Matrix inkTransform
)
public function Transform(
    inkTransform : Matrix
)

Параметры

Заметки

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.

Примеры

This C# example rotates a Stroke object, theStroke, by 180 degrees around the center of the Stroke object's bounding box.

using System.Drawing.Drawing2D;
//...
Matrix inkTransform = new Matrix();
Rectangle inkBounds = theStroke.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 stroke
theStroke.Transform(inkTransform);

This Microsoft Visual Basic .NET example rotates a Stroke object, theStroke, by 180 degrees around the center of the Stroke object's bounding box.

Imports System.Drawing.Drawing2D
'...
Dim inkTransform As New Matrix()
Dim inkBounds As Rectangle = theStroke.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 stroke
theStroke.Transform(inkTransform)
n

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

Stroke Класс

Stroke - члены

Transform - перегрузка

Microsoft.Ink - пространство имен

Transform

Stroke.Move

Stroke.Rotate

Strokes.Transform