Region::Union(constRect&) メソッド (gdiplusheaders.h)

Region::Union メソッドは、この領域を、それ自体のすべての部分 (交差および非インターセクト) と、指定した四角形の内部のすべての部分に更新します。

構文

Status Union(
  const Rect & rect
);

パラメーター

rect

この領域を更新するために使用する四角形への参照。

戻り値

種類: 状態

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

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

解説

次の例では、パスから領域を作成し、四角形を使用して領域を更新します。 更新された領域は、パス領域と四角形の和集合です。

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

   Point points[] = {
      Point(110, 20),
      Point(120, 30),
      Point(100, 60),
      Point(120, 70),
      Point(150, 60),
      Point(140, 10)};

   Rect rect(65, 15, 70, 45);
   GraphicsPath path;
   SolidBrush solidBrush(Color(255, 255, 0, 0));

   path.AddClosedCurve(points, 6);

   // Create a region from a path.
   Region pathRegion(&path);

   // Form the union of the region and a rectangle.
   pathRegion.Union(rect);

   graphics.FillRegion(&solidBrush, &pathRegion);
}

要件

要件
Header gdiplusheaders.h

こちらもご覧ください

リージョン

Rect

状態