Grid Ctrl...

PROGRAMING/BCG 2012.10.18 22:10

 

 

 

I think adding columns to an existing grid adds only the column and not the cells. It's probably a good thing if yu have merged cells anywhere. So basically if the row count isn't equal to the reported grid column count check and add cells to it.

CBCGPGridRow* pRow = m_pGridCtrl->GetRow(iRow);
if(pRow!=NULL) // For some reason adding columns to an existing grid only adds them to the header row?
{// (it appears adding a new column to an existing grid doesn't create the cells)
while(pRow->GetItemCount() != m_pGridCtrl->GetColumnCount())
{
for(int iFillRow = 0; iFillRow<m_pGridCtrl->GetColumnCount(); iFillRow++)
{
if(!pRow->GetItem(iFillRow))
{ CBCGPGridItem * pCell = m_pGridCtrl->CreateItem(iRow,iFillRow);
ASSERT(pCell);
pRow->AddItem(pCell);
}
}
}
}

 

'PROGRAMING > BCG' 카테고리의 다른 글

Grid Ctrl...  (0) 2012.10.18
VS2010에서 컴파일할때 에러나는것  (0) 2012.06.28
Posted by 삼백야드


티스토리 툴바