共用方式為


Strokes.Transform 方法 (Matrix)

將線性轉換套用至 Strokes 集合,而不影響畫筆寬度。

命名空間:  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
)

參數

備註

轉換會套用至點,但不會套用至畫筆寬度。若要設定轉換中包含畫筆寬度的值,請使用這個方法的 Transform(Matrix, Boolean) 多載。

線性轉換可能表示縮放、旋轉、轉譯及轉換的組合。

範例

在這個範例中,附加至 InkOverlay 物件的 Strokes 集合會旋轉 180 度。旋轉時,會繞著 Strokes 集合之週框方塊的中心進行旋轉。

' 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