MS Flex Grid控件的使用(續三)

MS Flex Grid控件對於複雜的Cell內容表示就很困難了。在www.vchelp.net上有一個程序,是將一個列的cell作成了CheckBox。我們可以將Grid的一列的輸入加入錄入參照,就是這個列的內容只能來自於數據庫,方法如下

實現兩個消息影射:DoubleClick和KeyDown,

發生這些事件的時候,彈出一個對話框,在該對話框中定義一個Combox,其下拉內容來自與數據庫中即可了。

void CPageComplete::OnDblClickMsflexgridCorp()
{
 // TODO: Add your control notification handler code here
 long nCurCol = m_CorpGrid.GetCol();
 long nCurRow = m_CorpGrid.GetRow();
 
 if(m_CorpGrid.GetCol() == 2){
  CDlgSelCorpType dlgSelCorpType;
  if(dlgSelCorpType.DoModal()==IDOK){
   CString str = dlgSelCorpType.m_strSelCorpType;
   m_CorpGrid.SetText(str);
   }
  }

}

 

void CPageComplete::OnKeyDownMsflexgridCorp(short FAR* KeyCode, short Shift)
{
 // TODO: Add your control notification handler code here
 long nCurCol = m_CorpGrid.GetCol();
 long nCurRow = m_CorpGrid.GetRow();
 
 if(m_CorpGrid.GetCol() == 2){
  CDlgSelCorpType dlgSelCorpType;
  if(dlgSelCorpType.DoModal()==IDOK){
   CString str = dlgSelCorpType.m_strSelCorpType;
   m_CorpGrid.SetText(str);
  }
 }
 
}

 

。。。。。。。待續。。。。。。。。。。。。

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章