当前位置:编程学习 > C/C++ >>

c++如何画实心的箭头

 CDC *pDC = GetDC();
         CRect rect;   GetClientRect(rect);  //获得用户区域大小   
         CPen penBlue(PS_SOLID, 1, RGB(0, 0, 255)); 
         CPen* pOldPen = pDC->SelectObject(&penBlue);    //蓝笔红刷 
         CBrush brushRed(RGB(255, 255, 255));  
         CBrush* pOldBrush = pDC->SelectObject(&brushRed);   
         CPoint pts[7];   
         pts[0].x = rect.top;  
         pts[0].y = rect.left + rect.Height()/2;   
         pts[1].x = rect.Width()/2;  
         pts[1].y = rect.top ;  
         pts[2].x = pts[1].x;  
         pts[2].y = rect.Height()/3;  

         pts[3].x = rect.right;  
         pts[3].y = pts[2].y;  
         pts[4].x = pts[3].x ;  
         pts[4].y = rect.Height()*2/3;  
         pts[5].x = rect.Width()/2;  
         pts[5].y = pts[4].y; 
         pts[6].x = pts[5].x;  
         pts[6].y = rect.bottom; 
         pDC->Polygon(pts, 7);   // Put back the old objects. 
         pDC->SelectObject(pOldPen);  
         pDC->SelectObject(pOldBrush);

 

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