我把一个图形分解成弧(CArc类)和直线(CLine类),CArc和CLine从CGeometry派生,把构成图形的CArc和CLine指向基类的指针添加到m_GeoVector中。为什么构造弧的时候会莫名的添加几条没画出来的直线呢?以下是封装的CArc和添加到m_GeoVector的代码:
void CArc::Draw(CZoomDC *pDC)
{
CRect rect(int(m_x1), int(m_y1), int(m_x2), (int)m_y2);
CPoint point1(int((m_x1 + m_x2) / 2), int(m_y1));
CPoint point3(int(m_x2), int((m_y1 - m_y2) / 2 + m_y2));
CPoint point4(int(m_x1), int((m_y1 - m_y2) / 2 + m_y2));
if(m_flag == 0.25)
{
pDC->Arc(rect,point3,point1);
}
if(m_flag == -0.25)
{
pDC->Arc(rect,point1,point4);
}  
}
double y7 = y2 - (y2 - m_MomThick / 2) * 2;
pGeometry = new CArc(x2 - m_HL, -y2, x2 + m_HL, -y7, -0.25);
pGeometry->m_GType = CGeometry::GT_EDGE;
m_GeoVector.push_back(pGeometry);
lx = x2 - m_HL;