CombineRgn函数可以用于将两个区域进行混合操作,生成一个新的区域。以下是一个使用CombineRgn函数的示例代码:
CRgn winRgn;
CRgn otherRgn;
CRgn resultRgn;
CRect tmpRect{ 0,0,m_size.cx,m_size.cy };
otherRgn.CreateEllipticRgnIndirect(tmpRect); // 创建椭圆区域
CPoint pts[4] = { {21,203},{378,200},{170,543},{16,456} };
winRgn.CreatePolygonRgn(pts, _countof(pts), ALTERNATE); // 创建多边形区域
resultRgn.CombineRgn(&otherRgn, &winRgn, RGN_OR); 将两个区域进行合并
SetWindowRgn(resultRgn, TRUE); 将合并后的区域设为窗口
1、CRgn类的混合功能:
int CombineRgn( CRgn* pRgn1, CRgn* pRgn2, int nCombineMode );
RGN_AND 交集
RGN_COPY 拷贝
RGN_DIFF 不同
RGN_OR 并集
RGN_XOR 异或