-
May 7th, 2002, 09:11 AM
#1
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
-
June 24th, 2003, 06:59 PM
#2
Great Code! This helps me a lot!
Thanks,
Greg
Last edited by revg75; July 1st, 2003 at 09:52 PM.
-
June 25th, 2003, 03:30 AM
#3
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?
-
June 25th, 2003, 04:34 AM
#4
-
June 25th, 2003, 06:20 AM
#5
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 !
-
June 25th, 2003, 06:35 AM
#6
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
-
June 25th, 2003, 06:46 AM
#7
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?
-
June 25th, 2003, 06:50 AM
#8
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
-
June 25th, 2003, 07:04 AM
#9
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?
-
June 25th, 2003, 07:18 AM
#10
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.
-
June 25th, 2003, 07:44 AM
#11
Good... Thnx... I'll of cause give you credits for it...
Mail it to me at: largiee@hotmail.com
-
May 27th, 2004, 04:39 PM
#12
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|