1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| BOOL CtestDlg::OnInitDialog() { CBCGPDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE); SetIcon(m_hIcon, FALSE);
CRect rect(0, 0, 400, 400); m_pGridCtrl = new CBCGPGridCtrl; m_pGridCtrl->Create(WS_CHILD, rect, this, 1); m_pGridCtrl->ShowWindow(SW_SHOW);
m_pGridCtrl->InsertColumn(0, _T("name"), 40); m_pGridCtrl->InsertColumn(1, _T("sex"), 40);
CBCGPGridRow* pRow = new CBCGPGridRow; m_pGridCtrl->AddRow(pRow); CBCGPGridItem* pNameItem = pRow->CreateItem(0, 0); pRow->AddItem(pNameItem); pNameItem->SetValue("Nancy");
CBCGPGridItem* pSexItem = pRow->CreateItem(0, 1); pRow->AddItem(pSexItem); pSexItem->AddOption("男"); pSexItem->AddOption("女"); pSexItem->SetValue("男");
return TRUE; }
|