dc.Rectangle(50,20,450,350);
int i;  
for(i=50;i<350;i+=30)
{ dc.MoveTo(50,i);
dc.LineTo(450,i);
}
for(i=130;i<450;i+=80)
{ dc.MoveTo(i,20);
dc.LineTo(i,350);
}
_____________________________________________
以上为绘制坐标系的代码,编译后的提示为:
1.error C2065: 'dc' : undeclared identifier2.error C2228: left of '.Rectangle' must have class/struct/union type3.error C2228: left of '.MoveTo' must have class/struct/union type4. error C2228: left of '.LineTo' must have class/struct/union type5.error C2228: left of '.MoveTo' must have class/struct/union type6.error C2228: left of '.LineTo' must have class/struct/union type
Generating Code...
执行 cl.exe 时出错.hh.exe - 1 error(s), 0 warning(s)请问症结何在,谢谢解答

解决方案 »

  1.   

    dc没有定义,且一些函数的参数不正确,你还是查一下MSDN,看看你用的函数参数吧
      

  2.   

    void CHhDlg::OnChangeEdit1() 
    {
    // TODO: If this is a RICHEDIT control, the control will not
    // send this notification unless you override the CDialog::OnInitDialog()
    // function and call CRichEditCtrl().SetEventMask()
    // with the ENM_CHANGE flag ORed into the mask.

    // TODO: Add your control notification handler code here
    CClientDC dc(this);
    dc.Rectangle(50,20,450,350);
    int i;  
    for(i=50;i<350;i+=30)
    { dc.MoveTo(50,i);
    dc.LineTo(450,i);
    }
    for(i=130;i<450;i+=80)
    { dc.MoveTo(i,20);
    dc.LineTo(i,350);
    }}
    void CHhDlg::OnButton1() 
    {
    // TODO: Add your control notification handler code here
    OnChangeEdit1();
    }
    _______________________________________________________________
    现在的问题:程序运行成功,点按钮后生成坐标系,但之后无法返回,只能直接关闭.问如何解决?
      

  3.   

    绘图代码放在OnPaint()里面,用一些开关变量来控制void CHhDlg::OnChangeEdit1()里面,只需要设置开关变量,然后重新绘图即可
    Invalidate();
    UpdateWindow();