wxWidgets: wxListCtrl und die Hintergrundfarbe



  • Moin,

    ich habe ein wxListCtrl, dem ich in einzelnen Zeilen eine andere Hintergrundfarbe geben möchte. Jede Zeile erhält auch ein Image.

    Jedes einzelne für sich funktioniert, aber wenn ich ein Image und eine Hintergrundfarbe angebe, dann werden nur die Images angezeigt, aber der Hintergrund bleibt weiß.

    // Create ListCtrl
    m_pListShoots = new wxListCtrl(m_pSplitterWnd2, LIST_SHOOTS, wxDefaultPosition, wxSize(100,200), wxLC_REPORT);
    	m_pListShoots->InsertColumn(0, _T(""));
    	m_pListShoots->SetColumnWidth(0, 20);
    	m_pListShoots->InsertColumn(1, _("bla"));
    	m_pListShoots->SetColumnWidth(1, 40);
    	m_pListShoots->InsertColumn(2, _("Fasel"));
    	m_pListShoots->SetColumnWidth(2, 50);
    	m_pListShoots->InsertColumn(3, _("blafusel"));
    	m_pListShoots->SetColumnWidth(3, 50);
    
    // ImageList
            m_pImageList = new wxImageList(16, 16);
    
    	m_pImageList->Add(wxBitmap(_T("dir_up"), wxBITMAP_TYPE_BMP_RESOURCE));
    	m_pImageList->Add(wxBitmap(_T("dir_upright"), wxBITMAP_TYPE_BMP_RESOURCE));
    
    // Fill ListCtrl
    for(int i = 0; i < 20; ++i)
    {
    	wxListItem item = wxListItem();
    	item.SetColumn(0);
    	item.SetBackgroundColour(wxColour(125,125,125));
    
    	long index = m_pListShoots->InsertItem(item, imageid);
    
    	m_pListShoots->SetItem(index, 1, wxString::Format("%i", i + 1));
    	m_pListShoots->SetItem(index, 2, wxString::Format("%0.1f", value1));
    	m_pListShoots->SetItem(index, 3, wxString::Format("%i", value2));
    }
    

    Was mache ich falsch?


Anmelden zum Antworten