请教MFC画图碰到的问题
时间:2011-11-29
来源:互联网
我把一个图形分解成弧(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;
为什么构造弧的时候会莫名的添加几条没画出来的直线呢?以下是封装的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;
作者: yidao3502 发布时间: 2011-11-29
你把画直线的代码注释掉,看看呢?
作者: youzhe_1 发布时间: 2011-11-29
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28