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


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

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

Applies a linear transformation to a Strokes collection, not affecting the pen width.

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

Синтаксис

'Декларация
Public Sub Transform ( _
    inkTransform As Matrix _
)
'Применение
Dim instance As Strokes
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.

Примеры

In this example, the Strokes collection attached to an InkOverlay object is rotated by 180 degrees. The rotation occurs around the center of the bounding box of the Strokes collection.

' Access to the Strokes property returns a copy of the Strokes object.
' This copy must be implicitly (via using statement) or explicitly
' disposed of in order to avoid a memory leak.
Using allStrokes As Strokes = mInkOverlay.Ink.Strokes

    Dim inkTransform As Matrix = New Matrix()
    Dim bounds As Rectangle = allStrokes.GetBoundingBox()
    Dim center As PointF = _
        New PointF(0.5F * (bounds.Left + bounds.Right), _
                   0.5F * (bounds.Top + bounds.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
    allStrokes.Transform(inkTransform)
End Using
// Access to the Strokes property returns a copy of the Strokes object.
// This copy must be implicitly (via using statement) or explicitly
// disposed of in order to avoid a memory leak.
using (Strokes allStrokes = mInkOverlay.Ink.Strokes)
{
    Matrix inkTransform = new Matrix();
    Rectangle bounds = allStrokes.GetBoundingBox();
    PointF center = new PointF(0.5f * (bounds.Left + bounds.Right),
                               0.5f * (bounds.Top + bounds.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
    allStrokes.Transform(inkTransform);
}

Платформы

Windows Vista

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

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

.NET Framework

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

См. также

Ссылки

Strokes Класс

Strokes - члены

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

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

Strokes.Scale

Strokes.Move

Strokes.Rotate

Stroke.Transform