我已经画了椭圆,矩形。直线,那个polygon有几个参数,是怎样的,我不知道该怎么填。。
if(graph->m_nDrawType==1)//画直线
{
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->MoveTo(graph->m_startx,graph->m_starty);
pDC->LineTo(graph->m_endx,graph->m_endy); }
if(graph->m_nDrawType==2)//画矩形
{
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->Rectangle(graph->m_startx,graph->m_starty,graph->m_endx,graph->m_endy);
}
if(graph->m_nDrawType==3)//画椭圆
{
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->Ellipse(graph->m_startx,graph->m_starty,graph->m_endx,graph->m_endy); }
if(graph->m_nDrawType==0)//多边形 {
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->Polygon(0,graph->m_endx);
} },还差个多边形,大家帮我看看,谢谢
if(graph->m_nDrawType==1)//画直线
{
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->MoveTo(graph->m_startx,graph->m_starty);
pDC->LineTo(graph->m_endx,graph->m_endy); }
if(graph->m_nDrawType==2)//画矩形
{
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->Rectangle(graph->m_startx,graph->m_starty,graph->m_endx,graph->m_endy);
}
if(graph->m_nDrawType==3)//画椭圆
{
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->Ellipse(graph->m_startx,graph->m_starty,graph->m_endx,graph->m_endy); }
if(graph->m_nDrawType==0)//多边形 {
CreatePen(PS_SOLID,0,RGB(255,0,0));
pDC->Polygon(0,graph->m_endx);
} },还差个多边形,大家帮我看看,谢谢
BOOL Polygon(LPPOINT lpPoints, int nCount );
你的几个顶点的数组没有设。
很简单啊。第一个参数就是多边形的点数组。POINT结构的指针;第二个参数就是点的数量。
一般如下:
POINT pts[4];
//给pts赋值
pDC->Polygon(pts,4);