15,980
社区成员




//可以增加一个button ,点击button后设置虚拟模式
void CGridCtrlDemoDlg::OnBnClickedButtonVirtual()
{
m_pGrid.SetVirtualMode(TRUE);
m_pGrid.SetEditable(TRUE);
m_pGrid.SetRowCount(100000+1);//100000为实际数据 +1是表头
m_pGrid.SetColumnCount(11); //设置列数
m_pGrid.SetFixedRowCount(1);
}
BOOL CGridCtrlDemoDlg::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if (wParam == (WPARAM)m_Grid.GetDlgCtrlID())
{
*pResult = 1;
GV_DISPINFO *pDispInfo = (GV_DISPINFO*)lParam;
if (GVN_GETDISPINFO == pDispInfo->hdr.code)
{
//TRACE2("Getting Display info for cell %d,%d\n", pDispInfo->item.row, pDispInfo->item.col);
pDispInfo->item.strText.Format(_T("Message %d,%d"),pDispInfo->item.row, pDispInfo->item.col);
return TRUE;
}
else if (GVN_ODCACHEHINT == pDispInfo->hdr.code)
{
GV_CACHEHINT *pCacheHint = (GV_CACHEHINT*)pDispInfo;
Trace(_T("Cache hint received for cell range %d,%d - %d,%d\n"),
pCacheHint->range.GetMinRow(), pCacheHint->range.GetMinCol(),
pCacheHint->range.GetMaxRow(), pCacheHint->range.GetMaxCol());
}
}
return CDialog::OnNotify(wParam, lParam, pResult);
}