HRGN hrgn1 = CreateRectRgn(10, 10, 100, 100);//创建矩形区域 HRGN hrgn2 = CreateEllipticRgn(150, 150, 250, 250);//创建椭圆区域 HRGN hrgn= CreateRectRgn(0, 0, 0, 0); int n1=::CombineRgn(hrgn, hrgn1, hrgn2, RGN_OR); //将两个区域组合为一个新区域 HDC hdc = ::GetDC(m_hWnd); int n = SelectClipRgn(hdc, hrgn);//选择剪切区域 HBRUSH hbr = CreateSolidBrush(RGB(0, 0, 255)); //单色的画刷 BOOL b = PaintRgn(hdc, hrgn); //用HDC中的当前画刷填充区域 /* 参数1:HDC hdc 参数2:HRGN hrgn 区域 返回值:如果该函数成功,则返回值为非零值 如果函数失败,则返回值为零 */ DeleteObject(hbr); DeleteObject(hrgn); ::ReleaseDC(m_hWnd, hdc);
标签:PaintRgn,画刷,hrgn,区域,HDC,hdc,HRGN From: https://www.cnblogs.com/liming19680104/p/17403147.html