一,新建一个BCGprojectCBCGPGridCtrlSingle,基于对话框。

二。CCBCGPGridCtrlSingleDlg类定义变量。

CBCGPGridCtrl m_grid;

三,CCBCGPGridCtrlSingleDlg::OnInitDialog对网格控件进行初始化。

CRect r(0,0,200,200);

m_grid.Create(WS_CHILD, r, this, 1);

m_grid.ShowWindow(SW_SHOW);

m_grid.InsertColumn (0, _T("编号"), 40);

m_grid.InsertColumn (1, _T("网址"), 100);

const int iCol = m_grid.GetColumnCount ();

CBCGPGridRow* pRow = m_grid.CreateRow (iCol);

if( NULL == pRow )

return TRUE ;

pRow->GetItem(0)->SetValue(_T("1"));

CBCGPGridItem* pURLItem =  new CBCGPGridURLItem(_T("www.shnxh.cn"), _T(""));

pRow->ReplaceItem (1, pURLItem);

m_grid.AddRow (pRow, FALSE);

m_grid.AdjustLayout ();

四,Ctrl+F5执行。效果如图。

网格控件的简单有用

 

源代码下载:

网格控件的简单使用

相关文章:

  • 2021-06-02
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-15
  • 2021-06-25
  • 2022-01-05
  • 2021-12-04
  • 2021-11-20
相关资源
相似解决方案