CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    May 2000
    Location
    Langesund, Telemark in Norway!
    Posts
    292

    SOLUTION: How to hide the scrollbars on CListCtrl without loosing the functonality to scroll :)

    m_pl = CListCtrl!!!


    RECT ierect;
    int cxvs, cyvs;
    //m_pl.GetWindowRect (&ierect);
    m_pl.GetClientRect(&ierect);

    cxvs = GetSystemMetrics (SM_CXVSCROLL);
    cyvs = GetSystemMetrics (SM_CYVSCROLL);
    m_pl.SetWindowPos (0, ierect.left, ierect.top, ierect.right+cxvs, ierect.bottom+cyvs, SWP_NOMOVE | SWP_NOZORDER);
    ierect.bottom -= ierect.top+cyvs;
    //ierect.bottom -= (ierect.top-ierect.bottom);
    ierect.right -= ierect.left;
    ierect.top = 0;
    ierect.left = 0;
    HRGN iehrgn = CreateRectRgn (ierect.left, ierect.top, ierect.right-2, ierect.bottom);
    m_pl.SetWindowRgn (iehrgn, false);




    There are some trial and error to get it nice into your code, but I think it is a great solution to make a CListCtrl blend into the backround and make your own scrollbars (if needed )

    ListCtrl is good, but it just got better!


    Regards Large , aka Lars.
    Visit me at: http://lars.werner.no/
    Mail: large@writeme.com
    ==========================
    Lars Werner aka Large
    http://lars.werner.no/
    ==========================

  2. #2
    Join Date
    Jun 2003
    Posts
    91
    Great Code! This helps me a lot!

    Thanks,
    Greg
    Last edited by revg75; July 1st, 2003 at 09:52 PM.

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Maybe you can wrap this is a small article explaining the idea and how to integrate in your code etc. and submit it to CodeGuru?

  4. #4
    Join Date
    May 2000
    Location
    Langesund, Telemark in Norway!
    Posts
    292
    Maybe I'll do that...
    ==========================
    Lars Werner aka Large
    http://lars.werner.no/
    ==========================

  5. #5
    Join Date
    Oct 2002
    Location
    Italy
    Posts
    324

    An easier solution....

    I think this one is easier :
    - add the LVS_EX_FLATSB extended style to your list control;
    - use FlatSB_SetScrollProp to set the width and height of the scroll bars to zero.

    BYE !

  6. #6
    Join Date
    Apr 2002
    Location
    United Kingdom
    Posts
    310
    the ultimate way to dispose of the scrolls is.....

    Code:
    void 
    CListCtrlEx::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp) 
    {
         ModifyStyle( WS_HSCROLL | WS_VSCROLL, 0 );		
         CListCtrl::OnNcCalcSize( bCalcValidRects, lpncsp );
    }
    I managed to create a control that has an embedded tree & list
    control, using the above method, and also was able to provide
    my own scrollbars in the controls non-client area.

    regards

  7. #7
    Join Date
    May 2000
    Location
    Langesund, Telemark in Norway!
    Posts
    292
    I'll think I will collect the different styles of removing the scrollbars and make an article about it...

    Is it alright that I use your technique Filbert Fox?
    ==========================
    Lars Werner aka Large
    http://lars.werner.no/
    ==========================

  8. #8
    Join Date
    Apr 2002
    Location
    United Kingdom
    Posts
    310
    no problem, if you want to know how to set scrollbars in a client window then let me know, I am just finishing up on a project that demonstrates the above.

    regards

  9. #9
    Join Date
    May 2000
    Location
    Langesund, Telemark in Norway!
    Posts
    292
    If it is a demonstration prosject, then we can join together and write?

    I've just published "MessageMod" to Codeguru, project and planetsourcecode... So I have some experience writing them...

    Would that be interresting?
    ==========================
    Lars Werner aka Large
    http://lars.werner.no/
    ==========================

  10. #10
    Join Date
    Apr 2002
    Location
    United Kingdom
    Posts
    310
    If I had the time but I am very busy at the moment, but would be happy to supply any code or help if asked, the problem I am currently having is scrolling this is down to my controls being custom drawn, but should have solved very shortly, then I will send you project.

  11. #11
    Join Date
    May 2000
    Location
    Langesund, Telemark in Norway!
    Posts
    292
    Good... Thnx... I'll of cause give you credits for it...

    Mail it to me at: largiee@hotmail.com
    ==========================
    Lars Werner aka Large
    http://lars.werner.no/
    ==========================

  12. #12
    Join Date
    May 2000
    Location
    Langesund, Telemark in Norway!
    Posts
    292
    It has been some time, but you've been credited in several occations

    Here are 3 links to the article I wrote:
    http://www.codeproject.com/listctrl/ListCtrlSBHide.asp
    http://www.codeguru.com/listview/ListCtrlSBHide.html
    http://www.planetsourcecode.com/vb/s...=6461&lngWId=3

    Also the guy who made the skin clistctrl has given you credits:
    http://www.codeproject.com/listctrl/skinlist.asp

    Nice to know that your information is beeing used, and getting productive

    Keep up, best regards
    Lars Werner
    ==========================
    Lars Werner aka Large
    http://lars.werner.no/
    ==========================

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