现在的位置: 首页 > 综合 > 正文

VC6.0 CMSHFlexGrid

2013年05月20日 ⁄ 综合 ⁄ 共 1028字 ⁄ 字号 评论关闭

 
 m_nRow = 1;
 m_nCol = 1;
 char * colHead[5] = {"Jone", "Lucy", "Lily", "Oubama", "Bush"};
 char * rowHead[3] = {"Computer", "English", "Logic"};
 m_flexgrid.SetRow(0);
 for(int nCol = 0; nCol < 3; nCol++)
 {
  m_flexgrid.SetCol(nCol + 1);
  m_flexgrid.SetText(rowHead[nCol]);
 }

 m_flexgrid.SetCol(0);
 for(int nRow = 0; nRow < 5; nRow++)
 {
  m_flexgrid.SetRow(nRow + 1);
  m_flexgrid.SetText(colHead[nRow]);
 }

 m_flexgrid.SetBackColor(RGB(255, 255, 200));

 

void CCh7Demo7Dlg::OnDblClickMshflexgrid2()
{
 // TODO: Add your control notification handler code here
 CString szText = m_flexgrid.GetText();
 m_value = atof(szText);
 UpdateData(false);
 m_nRow = m_flexgrid.GetRow();
 m_nCol = m_flexgrid.GetCol();

 GetDlgItem(IDC_EDIT1)->EnableWindow(true);
 GetDlgItem(IDC_EDIT1)->SetWindowText(szText);
 GetDlgItem(IDC_BTN_REFER)->EnableWindow(true);
}

void CCh7Demo7Dlg::OnBtnRefer()
{
 // TODO: Add your control notification handler code here
 UpdateData(true);
 CString str;
 str.Format("%01.1f",m_value);
 m_flexgrid.SetText(str);
 GetDlgItem(IDC_EDIT1)->EnableWindow(false);
 GetDlgItem(IDC_BTN_REFER)->EnableWindow(false);
}

 

抱歉!评论已关闭.