Region::Xor (constRect&) 方法 (gdiplusheaders.h)

Region::Xor 方法會將這個區域更新為本身的非互動部分,以及指定的矩形內部。

語法

Status Xor(
  const Rect & rect
);

參數

rect

用來更新這個區域的矩形參考。

傳回值

類型: 狀態

如果方法成功,它會傳回Ok,這是 Status 列舉的元素。

如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。

備註

範例

下列範例會從路徑建立區域,然後使用矩形來更新區域。

VOID Example_XorRect(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);

   // Perform an exclusive OR operation on the region and a rectangle.
   pathRegion.Xor(rect);

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

規格需求

   
標頭 gdiplusheaders.h

另請參閱

區域

Rect

狀態