Ink.Clip メソッド
Stroke オブジェクトまたは Strokes コレクションにおいて、指定した四角形の外側にある部分を削除します。
名前空間 : Microsoft.Ink
アセンブリ : Microsoft.Ink (Microsoft.Ink.dll 内)
構文
'宣言
Public Sub Clip ( _
r As Rectangle _
)
'使用
Dim instance As Ink
Dim r As Rectangle
instance.Clip(r)
public void Clip(
Rectangle r
)
public:
void Clip(
Rectangle r
)
public void Clip(
Rectangle r
)
public function Clip(
r : Rectangle
)
パラメータ
- r
型 : System.Drawing.Rectangle
四角形の外側にある Stroke オブジェクトまたは Strokes コレクションはクリップされます。
解説
r パラメータはインク空間座標において指定されます。
四角形の外側にあるインクの部分は、Ink オブジェクトから削除されます。このため、Clip メソッドは、Stroke オブジェクトとこの四角形の交差点において Stroke オブジェクトに新しいポイントを追加する場合があります。
Ink オブジェクトの Clip メソッドを呼び出すと、Ink オブジェクトの Strokes コレクション内にある各 Stroke オブジェクトのプロパティが変わる場合があります。たとえば、Stroke オブジェクトがクリッピング四角形の領域内から開始してクリッピング四角形の外側に出た後、クリッピング四角形内に戻る場合、このオブジェクトは 2 つの Stroke オブジェクトになり、少なくとも 1 つのオブジェクトが新しい Id プロパティを持ちます。この動作にかかわらず、すべての Id プロパティは、プロパティが変わった場合であっても Ink オブジェクト内で必ず一意になります。Stroke オブジェクトのその他のプロパティも、同様に変更される場合があります。
このメソッドでは、クリッピング時にペンの幅は考慮されません。実際のインクまたはストローク データだけがクリップされます。
Stroke オブジェクトまたは Strokes コレクションでは、Clip メソッドは親の Ink オブジェクトを更新します。インクが Ink オブジェクトから削除されるたびに、この Ink オブジェクトに対して定義されている Stroke オブジェクトまたは Strokes コレクションが無効化されます。
インク データの操作方法の詳細については、「Ink Data」を参照してください。
例
この例では、インク コントロールのクライアント領域が取得され、HIMETRIC 単位に変換されてから、サイズが 1500 単位に縮小されます。次に Clip メソッドを使用して、Stroke オブジェクトの四角形の外側にある部分が削除されます。
' get the bottom right point of the client area for ink
' Note: InkOverlay.AttachedControl property must be set
Dim bottomRight As Point = New Point(mInkOverlay.AttachedControl.ClientSize)
' convert to HIMETRIC units
Using g As Graphics = mInkOverlay.AttachedControl.CreateGraphics()
mInkOverlay.Renderer.PixelToInkSpace(g, bottomRight)
End Using
' create a rectangle of the client area (HIMETRIC units)
Dim R As Rectangle = New Rectangle(0, 0, bottomRight.X, bottomRight.Y)
' shrink the rectangle by 1500
R.Inflate(-1500, -1500)
' clip the strokes to the rectangle
mInkOverlay.Ink.Clip(R)
mInkOverlay.AttachedControl.Invalidate()
// get the bottom right point of the client area for ink
// Note: InkOverlay.AttachedControl property must be set
Point bottomRight = new Point(mInkOverlay.AttachedControl.ClientSize);
// convert to HIMETRIC units
using (Graphics g = mInkOverlay.AttachedControl.CreateGraphics())
{
mInkOverlay.Renderer.PixelToInkSpace(g, ref bottomRight);
}
// create a rectangle of the client area (HIMETRIC units)
Rectangle R = new Rectangle(0, 0, bottomRight.X, bottomRight.Y);
// shrink the rectangle by 1500
R.Inflate(-1500, -1500);
// clip the strokes to the rectangle
mInkOverlay.Ink.Clip(R);
mInkOverlay.AttachedControl.Invalidate();
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0