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. CListCtrl

CListCtrl

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
5 Posts 4 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.
  • J Offline
    J Offline
    john5632
    wrote on last edited by
    #1

    Hi, How to bold a specific listcontrol row?

    Z R 2 Replies Last reply
    0
    • J john5632

      Hi, How to bold a specific listcontrol row?

      Z Offline
      Z Offline
      zon_cpp
      wrote on last edited by
      #2

      in OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) event of CListCtrl

      void CMyList::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
      {
      LPNMLVCUSTOMDRAW pLVCD reinterpret_cast(pNMHDR);
      switch(pLVCD->nmcd.dwDrawStage)
      {
      case CDDS_ITEMPREPAINT:
      if(pLVCD->nmcd.dwItemSpec == 1) // if it is specified row
      {
      pLVCD->clrTextBk = RGB(235,235,235);
      // and doing other
      }
      break;
      }
      }

      Zo.Naderi-Iran

      J 1 Reply Last reply
      0
      • Z zon_cpp

        in OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult) event of CListCtrl

        void CMyList::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
        {
        LPNMLVCUSTOMDRAW pLVCD reinterpret_cast(pNMHDR);
        switch(pLVCD->nmcd.dwDrawStage)
        {
        case CDDS_ITEMPREPAINT:
        if(pLVCD->nmcd.dwItemSpec == 1) // if it is specified row
        {
        pLVCD->clrTextBk = RGB(235,235,235);
        // and doing other
        }
        break;
        }
        }

        Zo.Naderi-Iran

        J Offline
        J Offline
        john5632
        wrote on last edited by
        #3

        It will chage the color of text, I need to make it BOLD

        L 1 Reply Last reply
        0
        • J john5632

          It will chage the color of text, I need to make it BOLD

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi, Modify the code zon_cpp gave you and use something like this in the CDDS_ITEMPREPAINT case:

          HFONT hOldFont = (HFONT)SelectObject(pLVCD>hdc, m_Font);
          // Draw your text... you can get the row/column text using GetItemText()
          // You can get the row# using pLVCD->nmcd.dwItemSpec
          // And get the column# using pLVCD->iSubItem
          // You can tell the CListCtrl *not* to draw over what you just did by setting *pResult = CDRF_SKIPDEFAULT;
          SelectObject(pLVCD>hdc, hOldFont);

          In your header add:

          CFont m_Font;

          In your dialog constructor add something like:

          m_Font.CreateFont(13,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,DEFAULT_PITCH | FF_DONTCARE,_T("MS Shell Dlg 2"));

          Best Wishes, -David Delaune

          1 Reply Last reply
          0
          • J john5632

            Hi, How to bold a specific listcontrol row?

            R Offline
            R Offline
            Rolf Kristensen
            wrote on last edited by
            #5

            Inherit from CGridListCtrlEx - Grid Control Based on CListCtrl[^] and override CGridListCtrlEx::OnDisplayRowFont()

            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