ListCtrl にいくつかの項目を挿入したいと考えています。これは私のコードです。プログラムでエラーが発生しないようです。残念ながら、すべてのアイテムがリストに表示されるわけではありません。なぜなのかわかりません。私を助けてください。
LVITEM lItem;
lItem.mask=LVIF_TEXT;
lItem.iItem = 1 + (nColNum - 1) * 3;
lItem.iSubItem=0;
lItem.pszText = W2T(L"");
pDlgSportNews->m_List.InsertItem( 1 + (nColNum-1 ) * 3 , lItem.pszText);
WCHAR szzText[MAX_PATH];
lItem.iItem = 1 + (nColNum - 1) * 3;
lItem.iSubItem = 1;
lItem.pszText = W2T(m_arData[nColNum - 1].szGameName);
pDlgSportNews->m_List.SetItemText(1 + (nColNum - 1) * 3 , 1 , lItem.pszText);
lItem.mask=LVIF_TEXT;
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 0;
lItem.pszText = W2T(m_arData[nColNum - 1].szGameTime);
pDlgSportNews->m_List.InsertItem(2 + + (nColNum - 1) * 3 , lItem.pszText);
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 1;
lItem.pszText = W2T(m_arData[nColNum - 1].szA_Team);
pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 1 , lItem.pszText);
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 2;
if (m_arData[nColNum - 1].bFT_HDP)
{
swprintf(szzText , L"%s %s" , m_arData[nColNum - 1].szFT_HDP , m_arData[nColNum - 1].szFT_A_HDP);
lItem.pszText = W2T(szzText);
}
else
lItem.pszText = W2T(m_arData[nColNum - 1].szFT_A_HDP);
pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 2 , lItem.pszText);
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 3;
swprintf(szzText , L"%s %s" , m_arData[nColNum - 1].szFT_UO , m_arData[nColNum - 1].szFT_A_UO);
lItem.pszText=W2T(szzText);
pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 3 , lItem.pszText);
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 4;
lItem.pszText = W2T(m_arData[nColNum - 1].szFT_S_Odd);
pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 4 , lItem.pszText);
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 5;
if (m_arData[nColNum - 1].bHT_HDP)
{
swprintf(szzText , L"%s %s" , m_arData[nColNum - 1].szHT_HDP , m_arData[nColNum - 1].szHT_A_HDP);
lItem.pszText=W2T(szzText);
}
else
lItem.pszText = W2T(m_arData[nColNum - 1].szHT_A_HDP);
pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 5 , lItem.pszText);
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 6;
swprintf(szzText , L"%s %s" , m_arData[nColNum - 1].szHT_UO , m_arData[nColNum - 1].szHT_A_UO);
lItem.pszText=W2T(szzText);
pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 6 , lItem.pszText);
lItem.iItem = 2 + (nColNum - 1) * 3;
lItem.iSubItem = 7;
lItem.pszText = W2T(m_arData[nColNum - 1].szHT_S_Odd);
pDlgSportNews->m_List.SetItemText( 2 + (nColNum - 1) * 3 , 7 , lItem.pszText);
lItem.pszText = W2T(L" ");
pDlgSportNews->m_List.InsertItem( 3 + (nColNum-1 ) * 3 , lItem.pszText);
lItem.iItem = 3 + (nColNum - 1) * 3;
lItem.iSubItem = 1;
lItem.pszText = W2T(m_arData[nColNum - 1].szB_Team);
pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 1 , lItem.pszText);
lItem.iItem = 3 + (nColNum - 1) * 3;
lItem.iSubItem = 2;
if (!m_arData[nColNum - 1].bFT_HDP)
{
swprintf(szzText , L"%s %s" , m_arData[nColNum - 1].szFT_HDP , m_arData[nColNum - 1].szFT_B_HDP);
lItem.pszText=W2T(szzText);
}
else
lItem.pszText = W2T(m_arData[nColNum - 1].szFT_A_HDP);
pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 2 , lItem.pszText);
lItem.iItem = 3 + (nColNum - 1) * 3;
lItem.iSubItem = 3;
lItem.pszText = W2T(m_arData[nColNum - 1].szFT_B_UO);
pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 3 , lItem.pszText);
lItem.iItem = 3 + (nColNum - 1) * 3;
lItem.iSubItem = 4;
lItem.pszText = W2T(m_arData[nColNum - 1].szFT_D_Odd);
pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 4 , lItem.pszText);
lItem.iItem = 3 + (nColNum - 1) * 3;
lItem.iSubItem = 5;
if (!m_arData[nColNum - 1].bHT_HDP)
{
swprintf(szzText , L"%s %s" , m_arData[nColNum - 1].szHT_HDP , m_arData[nColNum - 1].szHT_B_HDP);
lItem.pszText=W2T(szzText);
}
else
lItem.pszText = W2T(m_arData[nColNum - 1].szHT_B_HDP);
pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 5 , lItem.pszText);
lItem.iItem = 3 + (nColNum - 1) * 3;
lItem.iSubItem = 6;
lItem.pszText = W2T(m_arData[nColNum - 1].szHT_B_UO);
pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 6 , lItem.pszText);
lItem.iItem = 3 + (nColNum - 1) * 3;
lItem.iSubItem = 7;
lItem.pszText = W2T(m_arData[nColNum - 1].szHT_D_Odd);
pDlgSportNews->m_List.SetItemText( 3 + (nColNum - 1) * 3 , 7 , lItem.pszText);
pDlgSportNews->m_List.UpdateData();
UpdateData(FALSE);