Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC Grid Control - how to add an icon

MFC Grid Control - how to add an icon

Scheduled Pinned Locked Moved C / C++ / MFC
c++csshelptutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gomez_a
    wrote on last edited by
    #1

    J want to add an icon i one of the column i my CGridCtrl. Firts i add a class: class MGrid : public CGridCtrl { ... public: CImageList m_ImageList; } In my function Init_grid: m_ImageList.Create(MAKEINTRESOURCE(IDB_IMAGES), 16, 1, RGB(255,255,255)); SetImageList(&m_ImageList); (IDB_IMAGES is a smallicon.bmp file) Now I want to add an icon in 2 column of my grid: void MGrid::Draw_icon(int ARow) { int ACol = 0; int ilosc_col = GetColumnCount(); CString str = ""; GV_ITEM Item; for(ACol = 1; ACol <= ilosc_col; ACol++) { Item.row = ARow; Item.col = ACol; if(ACol == 2) { Item.mask = GVIF_TEXT; str.Format(_T("Column %d"), ACol); Item.strText = str; Item.iImage = 1; Item.mask |= (GVIF_IMAGE); SetItem(&Item); } } What I see is a string "Column 1" (..n) but there is no image in the column. Can you help me? Regards mwgomez Poland

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups