Strokes.Transform - метод (Matrix, Boolean)
Обновлен: Ноябрь 2007
Applies a linear transformation to a Strokes collection, with the option of applying the transformation to the pen width.
Пространство имен: Microsoft.Ink
Сборка: Microsoft.Ink (в Microsoft.Ink.dll)
Синтаксис
'Декларация
Public Sub Transform ( _
inkTransform As Matrix, _
applyOnPenWidth As Boolean _
)
'Применение
Dim instance As Strokes
Dim inkTransform As Matrix
Dim applyOnPenWidth As Boolean
instance.Transform(inkTransform, applyOnPenWidth)
public void Transform(
Matrix inkTransform,
bool applyOnPenWidth
)
public:
void Transform(
Matrix^ inkTransform,
bool applyOnPenWidth
)
public void Transform(
Matrix inkTransform,
boolean applyOnPenWidth
)
public function Transform(
inkTransform : Matrix,
applyOnPenWidth : boolean
)
Параметры
- inkTransform
Тип: System.Drawing.Drawing2D.Matrix
The System.Drawing.Drawing2D.Matrix transform to use on the Strokes collection.
- applyOnPenWidth
Тип: System.Boolean
The Boolean value that indicates whether to apply the transform to the width of the ink in the DrawingAttributes of the Stroke objects in the Strokes collection.Value
Meaning
true
The transformation applies to both the points and pen width.
false
The transformation applies only to the points.
Заметки
The linear transform can represent scaling, rotation, translation, and combinations of transformations.
If the pen width is scaled appropriately for the transform, the drawn pen width is calculated by multiplying the specified pen width (or default of 53, if unspecified) by the square root of the determinant of the transform.
Примеры
In this example, the Strokes collection attached to an InkOverlay object is scaled by a factor of two. The scaling occurs around the center of the bounding box of the Strokes collection. The width of the ink is also scaled by a factor of two.
' 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)
' Scale by factor of 2
inkTransform.Scale(2.0F, 2.0F)
' Translate back
inkTransform.Translate(-center.X, -center.Y)
' Transform strokes
allStrokes.Transform(inkTransform, True)
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);
// Scale by factor of 2
inkTransform.Scale(2.0F, 2.0F);
// Translate back
inkTransform.Translate(-center.X, -center.Y);
// Transform strokes
allStrokes.Transform(inkTransform, true);
}
Платформы
Windows Vista
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0