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 - 2

CListCtrl - 2

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 Posts 2 Posters 1 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.
  • S Offline
    S Offline
    Shankar Chandra Bose
    wrote on last edited by
    #1

    Hi, Am using an owner drawn list control, and I handle the WM_MEASUREITEM message to set the item height. Problem is, this message is sent only when a window is created (or so the MSDN documentation says). I'd like to set the item height, in response to user button clicks (to provide for the effect of zooming items)-this would let the user increase or decrease item heights by clicking buttons. Problem is, as noted earlier, the message is sent only when the list control is created-how do I set the item height, without destroying and creating the control again? Any help is much appreciated. --Shanker. "When it's done" - 3D Realms.

    B 1 Reply Last reply
    0
    • S Shankar Chandra Bose

      Hi, Am using an owner drawn list control, and I handle the WM_MEASUREITEM message to set the item height. Problem is, this message is sent only when a window is created (or so the MSDN documentation says). I'd like to set the item height, in response to user button clicks (to provide for the effect of zooming items)-this would let the user increase or decrease item heights by clicking buttons. Problem is, as noted earlier, the message is sent only when the list control is created-how do I set the item height, without destroying and creating the control again? Any help is much appreciated. --Shanker. "When it's done" - 3D Realms.

      B Offline
      B Offline
      Ben Burnett
      wrote on last edited by
      #2

      The fact that there is no way to set an item's RECT and that ListViews only supports LVS_OWNERDRAWFIXED leads me to believe that you are, unfortunately, out of luck... Unless, you only have one column in the ListView in question, then might I recommend moving to a ListBox instead... its WM_MEASUREITEM suffers the same problem ( only ever getting called once ), but you can set an items RECT at runtime ( like when the user clicks on it ).

      void CMyZoomListBox::OnSelchange()
      {
      if ( -1 != m_nLastSelection ) {

      	SetItemHeight ( m\_nLastSelection, m\_nNormalSize );
      
      }
      
      m\_nLastSelection = GetCurSel ();
      SetItemHeight ( m\_nLastSelection, m\_nZoomSize );
      
      Invalidate (); // update window to reflect size changes
      

      }

      Ben Burnett --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)

      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