CGridCtrlEx m_Grid;
BOOL CDlgFillinTable::SetContentsByNumericCol()
{
CCellID currentCell = m_Grid.GetFocusCell();
CString strContents = m_Grid.GetItemText(currentCell.row,currentCell.col);
if(strContents.IsEmpty())
return TRUE;
CString strText;
if (m_iSWeightNum == currentCell.col || m_iTWeightNum == currentCell.col || m_iCountNum == currentCell.col)
{
for(int i=0 ; i<strContents.GetLength() ; i++)
{
if(strContents.GetAt(i) < 46 || strContents.GetAt(i) > 57 || strContents.GetAt(i) == 47)
{
m_Grid.SetItemText(currentCell.row,currentCell.col,m_strContents);
break;
}
}
if ( 1<strContents.Replace(_T("\."),_T("\.")) || 46==strContents.GetAt(0) )//strContents.Find(_T("\."),0);
{
m_Grid.SetItemText(currentCell.row,currentCell.col,m_strContents);
}
}
return TRUE;
}
CGridCtrlEx表格及限制表格输入数字和‘.’
最新推荐文章于 2025-03-30 15:20:31 发布