16,551
社区成员
发帖
与我相关
我的任务
分享void Draw左白右黑圆(HDC dc,int x,int y int R)
{
RECT rcCir = {x-R,y-R,x+R,y+R};//圆的外切矩形
if (1)//画白圆
{
RECT ptrc = {x-R,y-R,x,y+R};
HRGN hGn = ::CreateRectRgn(ptrc.left, ptrc.top ,ptrc.right, ptrc.bottom);//限制绘图区域--挡住左半边不准画
int nm = ::SelectClipRgn(dc,hGn);
//.......................//画白色rcCir内切圆
::SelectClipRgn(dc,NULL);//恢复----将整个dc的全部区域作为绘制区域
::DeleteObject(hGn);
}
if (1)//画黑圆
{
RECT ptrc = {x,y-R,x+R,y+R};
HRGN hGn = ::CreateRectRgn(ptrc.left, ptrc.top ,ptrc.right, ptrc.bottom);//限制绘图区域--挡住右半边不准画
int nm = ::SelectClipRgn(dc,hGn);
//.......................//画黑色rcCir内切圆
::SelectClipRgn(dc,NULL);//恢复----将整个dc的全部区域作为绘制区域
::DeleteObject(hGn);
}
}
