// create the DBGrid control
&connect it to IDC_RDCSTUDENT
m_dbgstudent.Create(_T(""),WS_VISIBLE|WS_CHILD,r,
this,IDC_DBGSTUDENT);
LPUNKNOWN pCursor=m_rdcstudent.GetDSCCursor();
ASSERT(pCursor!=NULL);
m_dbgstudent.SetDataSource(pCursor); //bind the grid
m_dbgstudent.BindProperty(0x9, &m_rdcstudent);
return 0;
}
void CDbgridView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
// TODO: Add your message handler code here
CRect rect;
GetClientRect(rect);
::SetWindowPos(m_dbgstudent,HWND_TOP,0,0,rect.right
-rect.left,rect.bottom -rect.top,SWP_SHOWWINDOW);
}
6、编译并测试程序。