当前位置:编程学习 > VC++ >>

VC如何对不规则图形填充颜色

1. CRect rectCheck = rectBox; 
2. rectCheck.left += 3; 
3. rectCheck.top += 3; 
4.  
5. penLed.DeleteObject(); 
6. penLed.CreatePen(PS_SOLID, 1, RGB(19, 202, 0)); 
7. pDC->SelectObject(&penLed); 
8. brushLed.DeleteObject(); 
9. brushLed.CreateSolidBrush(RGB(19, 202, 0)); 
10. POINT p[] = { 
11.     {rectCheck.left + 0, rectCheck.top + 2}, 
12.     {rectCheck.left + 2, rectCheck.top + 4}, 
13.     {rectCheck.left + 6, rectCheck.top + 0}, 
14.     {rectCheck.left + 6, rectCheck.top + 2}, 
15.     {rectCheck.left + 2, rectCheck.top + 6}, 
16.     {rectCheck.left + 0, rectCheck.top + 4}, 
17.     {rectCheck.left + 0, rectCheck.top + 2} 
18. }; 
19. pDC->Polygon(p,7); 
20. CRgn rg;    www.zzzyk.com
21. rg.CreatePolygonRgn(p,7,WINDING); 
22. pDC->FillRgn(&rg,&brushLed); 

运行结果为一个对号!

 作者:testcs_dn

补充:软件开发 , Vc ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,