Re: Scrollbars and CListCtrl
"Henryk Birecki" <soaringpilot@sbcglobal.net> wrote in message
news:oe8843du21vepsrlvhkb3evg496nbt0sa8@4ax.com...
I am working with CListCtrl window which has only one column, but I
really need to suppress appearance of horizontal scroll bar. I tried
to modify window style to remove WS_HSCROLL, but seems that MFC
overrides me. For now I am suppressing it by loading data, getting
client rectangle and setting column width to client rectangle width.
Unfortunately this fails with PocketPC WinMobile 5. There
GetClientRect seems to return rectangle that includes scrollbar. This
adds a problem of now finding the width of vertical scrollbar,
solution to which is not obvious to me.
There must be a better way to suppress horizontal scrollbar in
CListCtrl. Can someone please point me at it, or at least tell me how
to programatically find scroll bar width in CListCtrl.
The horizontal scrollbar does not appear if all the columns fit without
needing to be scrolled. Since there is only one column, all you have to do
is resize that column so that it is the exact width of the client area. To
do that:
MyListCtrl.SetColumnWidth (0, LVSCW_AUTOSIZE_USEHEADER);
-- David