Announcement

Collapse
No announcement yet.

Listview sizing question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Listview sizing question

    I need to make the last column of a listview extend to the right margin of the listview and cause the depth of the listview to show whole rows and not partial. I'd also like to widen vertically the listview rows so there is more space between rows other than the default usually assigned by the font that is set.

    Also if the widening of the columns causes a horizontal scroll bar to appear at the bottom, how do I do the measurements to adjust the size of the listview so that only whole rows appear.

    Bob Mechler

  • #2
    You might check out the MSDN site:
    ms-help://MS.LHSMSSDK.1033/MS.LHSWinSDK.1033/Controls/controls/listview/reflist.htm

    You should find exactly what you want there.
    Last edited by Rodney Hicks; 12 Aug 2009, 05:25 PM.
    Rod
    I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

    Comment


    • #3
      Bad link, but if that's for listBOX controls as suggested by the link name, that won't help for a listVIEW control.

      Listview_SetColumnWidth = adjust column widths. Many options.

      On making the (vertical?) size such that partial rows don't show? I think you will need to use ListView_GetItemRect to get the size of an item (its RECT), then use AdjustWindowRect() based on a client height you calculate based on the number of rows you want to show and the unit height, then SetWindowPos() or MoveWindow() to resize the control. I think you'll also have to allow separately for the size of the listview's header control if present (code not shown) in your client size calculations.

      MCM
      Michael Mattias
      Tal Systems Inc. (retired)
      Racine WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Fixed the link! Sorry!
        Rod
        I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

        Comment


        • #5
          >Fixed the link! Sorry!

          You did? IE 7 does not like it!

          (Is that a link to something on your local disk?)

          This gets you to the start of the listview controls reference on-line:
          http://msdn.microsoft.com/en-us/library/aa922166.aspx

          MCM
          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Decidedly curious that link. It is on my disk, for I can access it while disconnected(cached?). Yet I hadn't downloaded any thing from MSDN, only searched what I thought was their site and bookmarked. This is the link I started at and when I found the page I copied and pasted here.
            http://msdn.microsoft.com/en-us/default.aspx
            Rod
            I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

            Comment


            • #7
              Sounds like he knows how to size, what he needs is to use %LVSCW_AUTOSIZE_USEHEADER in the call to set the column width which has the same effect as double clicking the column dividers in the header.

              Be aware though that XP has a bug in that if you use OwnerData and don't just add your items to the listview, neither %LVSCW_AUTOSIZE_USEHEADER or doudleclicking the divider for the first column will size right. This only applies if you link the theme xml to your exe too, not having themes on causes it to use the old version of the DLL and it will work fine. They fixed it in Vista along with an additional style that makes the Listview autosize all columns for you...but I doubt they will ever fix it in XP since it has been there forever and is another reason to put the virus known as Vista on your PC.
              sigpic
              Mobile Solutions
              Sys Analyst and Development

              Comment

              Working...
              X