MFC 计算机图形学  void CLineView::OnDraw(CDC* pDC){int x1,x2,y1,y2,color;x1=0;y1=0;x2=5;y2=2;color=RGB(255,0,0);//DDALine(pDC,x1,y1,x2,y2,color);double k=1.0*(y2-y1)/(x2-x1);int x;double y;for(x=x1;xSetPixel(x,int(y+0.5),color);y=y+k;}CLineDo

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 08:25:41
MFC计算机图形学 voidCLineView::OnDraw(CDC*pDC){intx1,x2,y1,y2,color;x1=0;y1=0;x2=5;y2=2;color=RGB(255,0,0)

MFC 计算机图形学  void CLineView::OnDraw(CDC* pDC){int x1,x2,y1,y2,color;x1=0;y1=0;x2=5;y2=2;color=RGB(255,0,0);//DDALine(pDC,x1,y1,x2,y2,color);double k=1.0*(y2-y1)/(x2-x1);int x;double y;for(x=x1;xSetPixel(x,int(y+0.5),color);y=y+k;}CLineDo
MFC 计算机图形学 
void CLineView::OnDraw(CDC* pDC)
{
int x1,x2,y1,y2,color;
x1=0;
y1=0;
x2=5;
y2=2;
color=RGB(255,0,0);
//DDALine(pDC,x1,y1,x2,y2,color);
double k=1.0*(y2-y1)/(x2-x1);
int x;
double y;
for(x=x1;xSetPixel(x,int(y+0.5),color);
y=y+k;
}
CLineDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO:add draw code for native data here
}
为什么画不出呢,

MFC 计算机图形学  void CLineView::OnDraw(CDC* pDC){int x1,x2,y1,y2,color;x1=0;y1=0;x2=5;y2=2;color=RGB(255,0,0);//DDALine(pDC,x1,y1,x2,y2,color);double k=1.0*(y2-y1)/(x2-x1);int x;double y;for(x=x1;xSetPixel(x,int(y+0.5),color);y=y+k;}CLineDo
将double y=0,再试试看,应该在左上角