Region::Complement (constRect&) 方法 (gdiplusheaders.h)
Region::Complement 方法會將這個區域更新為未與這個區域交集之指定矩形內部的部分。
語法
Status Complement(
const Rect & rect
);
參數
rect
用來更新這個 Region 物件的矩形參考。
傳回值
類型: 狀態
如果方法成功,它會傳回Ok,這是 Status 列舉的元素。
如果方法失敗,它會傳回 Status 列舉的其他其中一個專案。
備註
範例
下列範例會從路徑建立區域,然後使用矩形來更新區域。
VOID Example_ComplementRect(HDC hdc)
{
Graphics graphics(hdc);
SolidBrush solidBrush(Color(255, 255, 0, 0));
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;
path.AddClosedCurve(points, 6);
// Create a region from a path.
Region region(&path);
// Update the region so that it consists of all points inside the
// rectangle but outside the path region.
region.Complement(rect);
graphics.FillRegion(&solidBrush, ®ion);
}
規格需求
需求 | 值 |
---|---|
標頭 | gdiplusheaders.h |