Strokes.Transform 方法 (Matrix, Boolean)
將線性轉換套用至 Strokes 集合,並且可以選擇將轉換套用至畫筆寬度。
命名空間: 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
要在 Strokes 集合上使用的 System.Drawing.Drawing2D.Matrix (英文) 轉換。
- applyOnPenWidth
型別:System.Boolean
布林值,表示是否將轉換套用至 Strokes 集合中 Stroke 物件之 DrawingAttributes 中筆墨的寬度。值
意義
true
轉換會套用至點和畫筆寬度。
false
轉換只會套用至點。
備註
線性轉換可能表示縮放、旋轉、轉譯及轉換的組合。
如果畫筆寬度會配合轉換適當縮放,則繪製的畫筆寬度計算方式,是將指定的畫筆寬度 (未指定時預設為 53) 與轉換的行列式平方根相乘。
範例
在這個範例中,附加至 InkOverlay 物件的 Strokes 集合會依因數 2 縮放。縮放時,會在 Strokes 集合週框方塊的中心四周進行縮放。筆墨的寬度也會依因數 2 縮放。
' 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