本文共 1592 字,大约阅读时间需要 5 分钟。
void CDialog_CRgn_104::OnBnClickedButton1()
{ // TODO: 在此添加控件通知处理程序代码 CRgn rgn1,rgn2,rgn3; /*rgn1.CreateRectRgn(0,0,100,150); rgn1.DeleteObject();*/ //rgn1.CreateRectRgnIndirect(CRect(0,0,100,150)); //rgn1.CreateEllipticRgn(0,0,100,150); rgn1.CreateEllipticRgnIndirect(CRect(0,0,100,150)); rgn2.CreateRectRgnIndirect(CRect(0,22,150,222)); rgn3.CreateEllipticRgnIndirect(CRect(120,199,220,150)); rgn1.CombineRgn(&rgn2,&rgn3,RGN_OR ); //rgn1=rgn2+rgn3; CDC *pdc=GetDC(); CBrush bsh(0xff); pdc->FillRgn(&rgn1,&bsh); //pdc->Rectangle() rgn1.DeleteObject(); rgn2.DeleteObject(); rgn3.DeleteObject(); ReleaseDC(pdc); }void CDialog_CRgn_104::OnLButtonDown(UINT nFlags, CPoint point)
{ // TODO: 在此添加消息处理程序代码和/或调用默认值 TRACE("%d,%d,",point.x,point.y); static CDC *pdc=GetDC(); pdc->SetPixel(point,0xFF); pdc->LineTo(point); CDialog::OnLButtonDown(nFlags, point); }void CDialog_CRgn_104::OnBnClickedButton2()
{ // TODO: 在此添加控件通知处理程序代码 CRgn rgn; POINT p[22]={140,49,262,14,346,92,287,186,153,165/* */,129,140,76,39,153,47,63,45,20}; rgn.CreatePolygonRgn(p,5,1 );//WINDING CDC *pdc=GetDC(); CBrush bsh(0xFF000); pdc->FillRgn(&rgn,&bsh);;rgn.DeleteObject();
ReleaseDC(pdc); }void CDialog_CRgn_104::OnBnClickedButton3()
{ // TODO: 在此添加控件通知处理程序代码 CRgn r25; POINT p[14]={64,51,138,22,133,87, 94,60,193,49,219,120,134,175,93,124,110,95,200,109,321,131,287,203,191,241,173,134}; //int pn[2]={5,5}; //r25.CreatePolyPolygonRgn(p,pn,2,ALTERNATE ); int pn[3]={3,6,5}; r25.CreatePolyPolygonRgn(p,pn,3,WINDING); CDC *pdc=GetDC(); CBrush bsh(0xFF000); pdc->FillRgn(&r25,&bsh);;r25.DeleteObject();
ReleaseDC(pdc);}
转载地址:http://pdfmd.baihongyu.com/