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();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
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; // return TRUE unless you set the focus to a control
}
|