GridCtrl控件已经创建成功了,请问我想根据里面输好的数据画出直线;已经设计好了输起点和终点的横纵坐标的单元格,我不知道怎么获取单元格的文本内容。
是有相应函数吗?

解决方案 »

  1.   

    CString CGridCtrl::GetItemText(int nRow, int nCol) const
      

  2.   


    出现以下错误:
    LeftView.cpp(48) : error C2065: 'm_pGridCtrl' : undeclared identifier
    D:\\LeftView.cpp(48) : error C2227: left of '->GetItemText' must point to class/struct/union
    D:\\LeftView.cpp(49) : error C2227: left of '->GetItemText' must point to class/struct/union
    D:\\LeftView.cpp(50) : error C2227: left of '->GetItemText' must point to class/struct/union
    D:\\LeftView.cpp(51) : error C2227: left of '->GetItemText' must point to class/struct/union
    Error executing cl.exe.m_pGridCtrl->GetItemText(4,1);这么写不对吗?
    头文件我已经加进去了啊。。
      

  3.   

    m_pGridCtrl这个变量你没定义吧?
      

  4.   

    是这样的,我的程序有两个View:
    我在LeftView中创建了GridCtrl,用的是CGridCtrl* m_pGridCtrl1;
    但是在RightView中写
    CString sx =m_pGridCtrl->GetItemText(4,1);
    运行出现错误D:\\LeftView.cpp(73) : error C2065: 'm_pGridCtrl' : undeclared identifier
    D:\\LeftView.cpp(73) : error C2227: left of '->GetItemText' must point to class/struct/union
    D:\\LeftView.cpp(76) : error C2227: left of '->GetItemText' must point to class/struct/union
    D:\\LeftView.cpp(79) : error C2227: left of '->GetItemText' must point to class/struct/union
    D:\\LeftView.cpp(82) : error C2227: left of '->GetItemText' must point to class/struct/union
    Error executing cl.exe.
    我觉得头文件我都已经包含进去了。
    可是问题还是没有解决,为什么呢?
      

  5.   

    是这样的,我的程序有两个View:
    我在LeftView中创建了GridCtrl,用的是CGridCtrl* m_pGridCtrl1;
    但是在RightView中写
    CString sx =m_pGridCtrl->GetItemText(4,1);
    运行出现错误
    别的暂且不说 你仔细看看你的变量 ,CGridCtrl* m_pGridCtrl1;你用的时候是m_pGridCtrl  这个是有区别的