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. CListView columns ideal size

CListView columns ideal size

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelptutorial
6 Posts 3 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.
  • P Offline
    P Offline
    PatrykDabrowski
    wrote on last edited by
    #1

    Hi:) Beginer question (I think;) - how to make my CListView columns (I use a report view) to fill in all available list width? (without adding scrollbar control at the bottom). When I use m_ListView.GetClientRect() and then set my two columns width to the 1/2 of the returned value, I still get a scroll bar at the bottom...?!? (couple of pixels, but still...) Is it possible to remove the last column's separator?? I could just shrink last column by 2-4 pixels and remove its ending separator to look nice;) How to do it?? Thanks for any help/comment.

    N 1 Reply Last reply
    0
    • P PatrykDabrowski

      Hi:) Beginer question (I think;) - how to make my CListView columns (I use a report view) to fill in all available list width? (without adding scrollbar control at the bottom). When I use m_ListView.GetClientRect() and then set my two columns width to the 1/2 of the returned value, I still get a scroll bar at the bottom...?!? (couple of pixels, but still...) Is it possible to remove the last column's separator?? I could just shrink last column by 2-4 pixels and remove its ending separator to look nice;) How to do it?? Thanks for any help/comment.

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      PatrykDabrowski wrote:

      Is it possible to remove the last column's separator?? I could just shrink last column by 2-4 pixels and remove its ending separator to look nice;) How to do it??

      You can use SetColumnWidth or specify the width when creating columns.


      Nibu thomas A Developer Programming tips[^]  My site[^]

      P 1 Reply Last reply
      0
      • N Nibu babu thomas

        PatrykDabrowski wrote:

        Is it possible to remove the last column's separator?? I could just shrink last column by 2-4 pixels and remove its ending separator to look nice;) How to do it??

        You can use SetColumnWidth or specify the width when creating columns.


        Nibu thomas A Developer Programming tips[^]  My site[^]

        P Offline
        P Offline
        PatrykDabrowski
        wrote on last edited by
        #3

        Yes, I'm already using SetColumnWidth(). My code works like this: 1) Get listView width by calling GetClientRect() 2) Call SerColumnWidth() for each (two in my case) column, setting (1/2*width) and (width-1/2*width) ...and still a scrollbar control appears at the bottom of my ListView control...?!?

        N 1 Reply Last reply
        0
        • P PatrykDabrowski

          Yes, I'm already using SetColumnWidth(). My code works like this: 1) Get listView width by calling GetClientRect() 2) Call SerColumnWidth() for each (two in my case) column, setting (1/2*width) and (width-1/2*width) ...and still a scrollbar control appears at the bottom of my ListView control...?!?

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          PatrykDabrowski wrote:

          ...and still a scrollbar control appears at the bottom of my ListView control...?!?

          There are some styles that you may like to look into LVS_NOSCROLL but this disables scrolling. Maybe you can pull the last column little bit more inside. :)


          Nibu thomas A Developer Programming tips[^]  My site[^]

          P 1 Reply Last reply
          0
          • N Nibu babu thomas

            PatrykDabrowski wrote:

            ...and still a scrollbar control appears at the bottom of my ListView control...?!?

            There are some styles that you may like to look into LVS_NOSCROLL but this disables scrolling. Maybe you can pull the last column little bit more inside. :)


            Nibu thomas A Developer Programming tips[^]  My site[^]

            P Offline
            P Offline
            PatrykDabrowski
            wrote on last edited by
            #5

            Yes, that's what I'm going to do - reduce last column by 2-4pixels...but that's some kind of a 'hack';) The goal is to create this listview without the scrollbar at the bottom but not by using LVS_NOSCROLL, but by resizing the columns. Of course the scrollbar should appear if I decrease the whole dialog window or change the column width using mouse.... Thanks for help anyway:)

            M 1 Reply Last reply
            0
            • P PatrykDabrowski

              Yes, that's what I'm going to do - reduce last column by 2-4pixels...but that's some kind of a 'hack';) The goal is to create this listview without the scrollbar at the bottom but not by using LVS_NOSCROLL, but by resizing the columns. Of course the scrollbar should appear if I decrease the whole dialog window or change the column width using mouse.... Thanks for help anyway:)

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              Use LVSCW_AUTOSIZE_USEHEADER for the cx param when you set the size of the LAST column.

              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