Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MFC Listelement mit Image

Empfohlene Antworten

Hallo,

ich habe ein Dialog mit einem Listelement. Ich möchte so was ereichen:

-------------------------------------

Name    | Status   | Status  | Status 

-------------------------------------

Anna    |    G     |   GL    |    R     

Mila    |    G     |   G     |    G     

--------------------------------------
Jeweils sind: G = Grün; GL = Gelb; R = Rot; Die Fargen habe ich als *.ico Dateien und sind auch in VC als IDR_GRUEN, IDR_GELB, IDR_ROT importiert. in On INITDIALOG habe ich:
HICON  hIcon = NULL;


// Create image list

m_ImageList.Create(16, 16, NULL, 3, 1);


// Add some icons

hIcon = AfxGetApp()->LoadIcon(IDR_GRUEN);

m_ImageList.Add(hIcon);


hIcon = AfxGetApp()->LoadIcon(IDR_GELB);

m_ImageList.Add(hIcon);


hIcon = AfxGetApp()->LoadIcon(IDR_ROT);

m_ImageList.Add(hIcon);


m_List1.SetImageList(&m_ImageList,LVSIL_NORMAL); // von CListBox


    m_List1.InsertColumn(0, "Name" ,LVCFMT_LEFT, 100);

    m_List1.InsertColumn(1, "Status " ,LVCFMT_LEFT, 70);


    // Elemente einfügen

    m_List1.InsertItem(0, "Anna");


  // HIER WILL ICH DIE ICONEN INCLUDEN

Meinem Problemm ist, ich weiss es nicht wie ich die Image´s in der Listelement schreiben kann. Könnte mir bitte jemand helfen ??

Das funktioniert:

	CWinApp* pApp = AfxGetApp();

	HICON    hStan, hKyle, hCartman;

	// Set up the image list.


    m_ImageList.Create ( 48, 48, ILC_COLOR16 | ILC_MASK, 3, 1 );


    hStan = reinterpret_cast<HICON>(

                ::LoadImage ( AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_G),

                              IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ));

    hKyle = reinterpret_cast<HICON>(

                ::LoadImage ( AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_GL),

                              IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ));

    hCartman = reinterpret_cast<HICON>(

                ::LoadImage ( AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_R),

                              IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ));


    m_ImageList.Add ( hStan );

    m_ImageList.Add ( hKyle );

    m_ImageList.Add ( hCartman );


    m_List1.SetImageList ( &m_ImageList, LVSIL_SMALL );

    m_List1.InsertColumn ( 0, _T("Name"), LVCFMT_LEFT, 40 );

	m_List1.InsertColumn ( 1, _T("Status"), LVCFMT_LEFT, 30);


    // And set up the list items.



    m_List1.InsertItem ( 0, _T(""), 0 );

    m_List1.InsertItem ( 1, _T(""), 1 );

    m_List1.InsertItem ( 2, _T(""), 2 );


    m_List1.SetColumnWidth ( 0, LVSCW_AUTOSIZE );


    m_List1.SetExtendedStyle ( LVS_EX_FULLROWSELECT );

Aber so habe ich die Image nur in erste Spalte, damit ich die Image in der 2, 3 ... einfügen kann, brauche ich
int InsertItem( UINT nMask, int nItem, LPCTSTR lpszItem, UINT nState, UINT nStateMask, int nImage, LPARAM lParam );

Ich verstehe aber nicht die Optionen UINT nMask, UINT nState, UINT nStateMask und LPARAM lParam von der Funktion InsertItem.

Könnte mir bitte jemand helfen. Ich habe was gelesen leider hilft es mir nicht.

Ich brauhe ein Beispiel, wenn es geht.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.