近日用到MFC Grid Control,
现已能显示出基本的GRID,
现有以下问题:
如何插入列标题和每列的数据,
如何在单元格显示出CHECKBOX,
如何获取用户操作之后的值,
等,官方没有教程,
那个DEMO也写得太复杂了点吧,
希望会使用这个控件的高手给些指导.
http://www.codeproject.com/KB/miscctrl/gridctrl.aspx

解决方案 »

  1.   

    把demo修改一下吧,没有办法。或者你换其他的界面库,比如bcg
      

  2.   


    try {
    m_pGridCtrl->SetFixedRowCount(2);         // 设置横列标题数量
    m_pGridCtrl->SetFixedColumnCount(1);      // 设置纵列标题数量
    m_pGridCtrl->SetRowCount(rowCount);       // 设置行数量
    m_pGridCtrl->SetColumnCount(colCount);    // 设置列数量
    }
    catch (CMemoryException* e)
    {
    e->ReportError();
    e->Delete();
    }// 以下为增加数据
    GV_ITEM Item;
    Item.mask = GVIF_TEXT | GVIF_FORMAT;
    Item.row = row;
    Item.col = col;
    Item.nFormat = DT_LEFT | DT_WORDBREAK;
    Item.strText.Format(szFixedRowTitle[col]);
    m_pGridCtrl->SetItem(&Item);
      

  3.   

    你要在Grid control控件的属性里面把列标题打勾
      

  4.   

    上http://www.pudn.com你可以随意看例子,上www.china-pub.com可以随意看免费电子书,上www.google.com/codesearch随意搜索你想要的代码
      

  5.   

    挺好用的啊,你需要To use it, either use the MS Visual C++ dialog editor to place a custom control on a dialog, and enter "MFCGridCtrl" (no quotes) as the Class name. To subclass the control using the DDX mechanism (this will be done by default by the ClassWizard) use the DDX_GridControl function instead of the DDX_Control function (just manually change the ClassWizard entry). This ensures your control is correctly registered as a drop target and avoids some weird win95 issues. 
      

  6.   

    谢谢各位的支持,我把官方的DEMO拆了,搞明白了.