R
Codetags benutzen!
2.
Schreib die Funktion mal folgendermassen (ist übersichtlicher):
BOOL CProductListWindow::OnInitDialog()
{
CDialog::OnInitDialog();
//m_pFile->printFunctionHeader("CMessageLog::OnInitDialog() ");
// Erlaube vollen Rowselect im Grid
DWORD dwStyle = m_cListProduct.GetExtendedStyle();
dwStyle |= LVS_EX_GRIDLINES;
m_cListProduct.SetExtendedStyle(dwStyle);
m_cListProduct.ModifyStyle( 0, LVS_OWNERDATA|LVS_REPORT);
// Erzeugt die Spalten in der Liste
LV_COLUMN lvCol;
lvCol.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
lvCol.fmt = LVCFMT_LEFT;
lvCol.iSubItem = 0;
LPCSTR szStrings[] = { "ProdTypID", "ProdID", "ProdShtName", "CurrTypCod", "ProdDispDcml", "MtchTypCod" };
int Widths[] = { 80, 100, 80, 100, 100, 100 };
for( int i=0; i<6; i++)
{
lvCol.pszText = szStrings[i];
lvCol.cx = Widths[i];
m_cListProduct.InsertColumn( i, &lvCol);
}
}
Achtung: Bei ModifyStyle musst Du im 1. Parameter den Stil angeben, den das ListCtrl vorher hatte, also LVS_ICON oder LVS_LIST oder LVS_SMALLICON !