Graphics::GetClipBounds(RectF*) メソッド (gdiplusgraphics.h)

Graphics::GetClipBounds メソッドは、この Graphics オブジェクトのクリッピング領域を囲む四角形取得します。

構文

Status GetClipBounds(
  RectF *rect
);

パラメーター

rect

クリッピング領域を囲む四角形を受け取る RectF オブジェクトへのポインター。

戻り値

メソッドが成功した場合は、Status 列挙体の要素である Ok を返します

メソッドが失敗した場合は、 Status 列挙体の他の要素のいずれかを返します。

注釈

ワールド変換がクリッピング領域に適用され、外側の四角形が計算されます。

Graphics オブジェクトのクリッピング領域を明示的に設定しない場合、そのクリッピング領域は無限になります。 クリッピング領域が無限の場合、 Graphics::GetClipBounds は 大きな四角形を返します。 その四角形の X および Y データ メンバーは負の数が大きく、 WidthHeight のデータ メンバーは大きな正の数値です。

次の例では、クリッピング領域を設定し、クリッピング領域を囲む四角形を取得し、四角形を塗りつぶします。

VOID Example_GetClipBounds2(HDC hdc)
{
   Graphics graphics(hdc);

   Region   myRegion(RectF(25.0f, 25.0f, 100.0f, 50.0f));
   RectF    rect(40.0f, 60.0f, 100.0f, 50.0f);
   Region   gRegion;
   RectF    enclosingRect;

   SolidBrush  blueBrush(Color(100, 0, 0, 255));
   Pen         greenPen(Color(255, 0, 255, 0), 1.5f);

   // Modify the region by using a rectangle.
   myRegion.Union(rect);

   // Set the clipping region of the graphics object.
   graphics.SetClip(&myRegion);

   // Now, get the clipping region, and fill it
   graphics.GetClip(&gRegion);
   graphics.FillRegion(&blueBrush, &gRegion);

   // Get a rectangle that encloses the clipping region, and draw the enclosing
   // rectangle.
   graphics.GetClipBounds(&enclosingRect);
   graphics.ResetClip();
   graphics.DrawRectangle(&greenPen, enclosingRect);}

要件

要件
Header gdiplusgraphics.h

こちらもご覧ください

クリッピング

領域でのクリッピング

GetVisibleClipBounds メソッド

グラフィックス

Graphics::GetClip

RectF

SetClip メソッド

状態