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. ATL / WTL / STL
  4. Draw subitem in SysListView32

Draw subitem in SysListView32

Scheduled Pinned Locked Moved ATL / WTL / STL
question
5 Posts 2 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.
  • Q Offline
    Q Offline
    qur
    wrote on last edited by
    #1

    I am creating the control based on SysListView32. Can some tell me how can i draw the subitems in OnDrawItem event.

    M 1 Reply Last reply
    0
    • Q qur

      I am creating the control based on SysListView32. Can some tell me how can i draw the subitems in OnDrawItem event.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      Check out Neat Stuff to do in List Controls Using Custom Draw[^] --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Pinky, are you pondering what I'm pondering? I think so Brain, but how will we fit the hamster inside the accordion? You cannot stop me with paramecium alone!

      Q 1 Reply Last reply
      0
      • M Michael Dunn

        Check out Neat Stuff to do in List Controls Using Custom Draw[^] --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- Pinky, are you pondering what I'm pondering? I think so Brain, but how will we fit the hamster inside the accordion? You cannot stop me with paramecium alone!

        Q Offline
        Q Offline
        qur
        wrote on last edited by
        #3

        Thanks.... I have try this code it works fine... but When i tried to draw a rectangle around the subitem in POSTPAINT event it did not work. Please see the code below else if ( (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage ) { if ( 0 == pLVCD->iSubItem ) { RECT rc; HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } else if ( 1 == pLVCD->iSubItem ) { HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } *pResult = CDRF_SKIPDEFAULT; } Please tell me whats wrong with this code.... Secondly can i display combo on one of the column using the CustomDraw event.

        M 1 Reply Last reply
        0
        • Q qur

          Thanks.... I have try this code it works fine... but When i tried to draw a rectangle around the subitem in POSTPAINT event it did not work. Please see the code below else if ( (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage ) { if ( 0 == pLVCD->iSubItem ) { RECT rc; HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } else if ( 1 == pLVCD->iSubItem ) { HPEN newPen, oldPen; newPen = CreatePen(PS_SOLID,1, RGB(0,0,0)); oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen ); Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom); SelectObject(pLVCD->nmcd.hdc, oldPen ); } *pResult = CDRF_SKIPDEFAULT; } Please tell me whats wrong with this code.... Secondly can i display combo on one of the column using the CustomDraw event.

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Check the rectangle that you're drawing. From the docs for NMCUSTOMDRAW:

          rc

          RECT structure that describes the bounding rectangle of the area being drawn. This member is initialized only by the CDDS_ITEMPREPAINT notification. Version 5.80. This member is also initialized by the CDDS_PREPAINT notification.

          --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer."   -- Michael P. Butler in the Lounge

          Q 1 Reply Last reply
          0
          • M Michael Dunn

            Check the rectangle that you're drawing. From the docs for NMCUSTOMDRAW:

            rc

            RECT structure that describes the bounding rectangle of the area being drawn. This member is initialized only by the CDDS_ITEMPREPAINT notification. Version 5.80. This member is also initialized by the CDDS_PREPAINT notification.

            --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer."   -- Michael P. Butler in the Lounge

            Q Offline
            Q Offline
            qur
            wrote on last edited by
            #5

            I am doing it in hardest way by capturing the OnDrawItem event. i am trying to dislay the Combos over the cell in this event, but problem is that when i resize the other column combos did not refreshed properly. What is the solution for this. thanks

            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