CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2004
    Posts
    23

    Question CListCtrl alignment of items & vertical scroll

    I've used a CListCtrl controller in my app, which works fine, except that I cannot figure out how to list all the items vertically.

    By default the controller displays all items by adding a horizontal scrollbar.
    I've removed the horizontal scrollbar by adding and removing the styles of the controller, however, for some reason I'm not able to get the items listed underneath each other when the list is long. When exceeding the height of the controller, it adds another column...and so on.

    How can I change this?
    I've tried using

    pListColumn->ModifyStyle(WS_HSCROLL , WS_VSCROLL | LVS_AUTOARRANGE| LVS_LIST );

    in multiple ways, but cant figure out the correct way to set the style to use!

    Any help would be greatly appreciated!

  2. #2
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    Re: CListCtrl alignment of items & vertical scroll

    The ListCtrl has quite a few styles. You need to set the style of Report view LVS_REPORT when you create ListCtrl or change it in resource editor....

    Regards,
    Usman.

  3. #3
    Join Date
    Nov 2004
    Posts
    23

    Talking Re: CListCtrl alignment of items & vertical scroll

    Thanks usman999_1!

    Made it work now by using the LVS_REPORT style.
    Don't know why, but I've been focusing a bit too much on the LVS_LIST style...


    Thanks again!

  4. #4
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    Re: CListCtrl alignment of items & vertical scroll

    You are welcome & also welcome to rate the post ....
    Regards,
    Usman.

  5. #5
    Join Date
    Dec 2001
    Posts
    4

    Re: CListCtrl alignment of items & vertical scroll

    Also achieved programmatically through CListCtrl::SetView(LV_VIEW_DETAILS), which is equivalent to:
    DWORD dw = myListCtrl.GetStyle();
    assert(dw && LVS_REPORT);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured