Strokes.GetBoundingBox メソッド
既定の BoundingBoxMode フラグを使用して境界を決定し、Stroke オブジェクトを含む、外接する Rectangle を返します。
名前空間 : Microsoft.Ink
アセンブリ : Microsoft.Ink (Microsoft.Ink.dll 内)
構文
'宣言
Public Function GetBoundingBox As Rectangle
'使用
Dim instance As Strokes
Dim returnValue As Rectangle
returnValue = instance.GetBoundingBox()
public Rectangle GetBoundingBox()
public:
Rectangle GetBoundingBox()
public Rectangle GetBoundingBox()
public function GetBoundingBox() : Rectangle
戻り値
型 : System.Drawing.Rectangle
Strokes コレクションの境界ボックスを定義する、外接する Rectangle を返します。
解説
外接する Rectangle はインク空間座標内にあります。
外接する Rectangle は、Strokes コレクションを表示するときに無効化または再描画する表示部分に対応しています。
境界ボックスがペンの幅の影響を受ける場合は、Renderer オブジェクトのビュー変換に合わせてペンの幅が適切にスケーリングされます。つまり、ペンの幅はビュー変換の行列式の平方根で乗算されてスケーリングされます。
メモ : |
---|
ペンの幅を明示的に設定していない場合、その既定値は 53 です。正しい境界ボックスを生成するためには、ペンの幅を行列式の平方根で乗算する必要があります。境界ボックスの高さと幅はそれぞれ、この計算結果値の 1/2 だけ拡大されます。たとえば、ペンの幅が 53 で行列式の平方根が 50、境界ボックスが (0, 0, 1000, 1000) であるとします。ペンの幅は (53 * 50) / 2 の計算結果に従って、境界ボックスの各方向に対して調整され、右側と下側は 1 ずつ増えます。この結果、(-1325, -1325, 2326, 2326) の境界ボックスが描画されます。 |
メモ : |
---|
このメソッドが返す、外接する Rectangle は、Strokes コレクションの境界ボックスのコピーです。このメソッドが返す Rectangle を変更しても、元の Strokes コレクションの境界ボックスには影響しません。 |
例
この例では、InkOverlay オブジェクトの Strokes コレクションが Strokes コレクションの右半分にクリップされます。まず、GetBoundingBox メソッドを呼び出すことにより、Strokes コレクションが取得されます。次に、右半分がクリップされた新しい四角形が作成され、Clip メソッドに渡されます。
' 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
' Determine the bounding box for the Strokes collection.
Dim bounds As Rectangle = allStrokes.GetBoundingBox()
'Create rectangle for Clip method.
Dim halfRectangle As Rectangle = _
New Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height)
' Clip the Strokes collection.
allStrokes.Clip(halfRectangle)
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)
{
// Determine the bounding box for the Strokes collection.
Rectangle bounds = allStrokes.GetBoundingBox();
//Create rectangle for Clip method.
Rectangle halfRectangle =
new Rectangle(bounds.Left, bounds.Top, bounds.Width / 2, bounds.Height);
// Clip the Strokes collection.
allStrokes.Clip(halfRectangle);
}
プラットフォーム
Windows Vista
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 3.0