TCHAR rgtsz[9][20] = {_T("字段一"), _T("字段二"), _T("字段三"), _T("字段四"), _T("字段五"), _T("字段六"), _T("字段七"), _T("字段八"), _T("字段九")};
LV_COLUMN lvcolumn;
CRect rect;
m_licList.GetWindowRect(&rect);
for(int i=0;i<9;i++)
{
lvcolumn.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH | LVCF_ORDER;
lvcolumn.fmt = LVCFMT_LEFT;
lvcolumn.pszText = rgtsz[i];
lvcolumn.iSubItem = i;
lvcolumn.iOrder = i;
if(i==0)
{
lvcolumn.cx = rect.Width()*1/9 ;
}
else
{
lvcolumn.cx = rect.Width()*1/9;
}
m_licList.InsertColumn(i, &lvcolumn);
}
m_licList.SetExtendedStyle(LVS_EX_FULLROWSELECT|LVS_EX_TRACKSELECT|LVS_EX_UNDERLINEHOT|LVS_EX_GRIDLINES);
INT nRow = 0 ;
for ( INT nIndex = 0 ; nIndex < m_ayInfo.GetSize() ; nIndex ++ )
{
nRow = m_licList.InsertItem( 0, m_ayInfo.ElementAt( nIndex ).strBillNo );//²åÈëÐÐ
str.Format( "%f", m_ayInfo.ElementAt( nIndex ).fPrice ) ;
m_licList.SetItemText( nRow, 1, str );//ÉèÖÃÊý¾Ý
m_licList.SetItemText( nRow, 2, m_ayInfo.ElementAt( nIndex ).strBillName );
m_licList.SetItemText( nRow, 3, m_ayInfo.ElementAt( nIndex ).strBillADD );
m_licList.SetItemText( nRow, 4, m_ayInfo.ElementAt( nIndex ).strBillTele );
m_licList.SetItemText( nRow, 5, m_ayInfo.ElementAt( nIndex ).strBillTime );
str.Format( "%f", m_ayInfo.ElementAt( nIndex ).fYSF ) ;
m_licList.SetItemText( nRow, 6, str );
str.Format( "%f", m_ayInfo.ElementAt( nIndex ).fZCF ) ;
m_licList.SetItemText( nRow, 7, str );
str.Format( "%f", m_ayInfo.ElementAt( nIndex ).fXCF ) ;
m_licList.SetItemText( nRow, 8, str );