(1)ICON形式中,如果设置属性中对齐方式为LVS_ALIGNTOP,那么当内容容纳不下时,只会出现竖直滚动条(Vertical Scroll)
(2)ICON形式中,如果设置属性中对齐方式为LVS_ALIGNLEFT,那么当内容容纳不下时,只会出现水平滚动条(Vertical Scroll)
(3)Report形式中,当行容纳不下时,出现竖直滚动条;当列容纳不下时,出现水平滚动条
有些时候,如果要强烈禁止出现水平滚动条或者竖直滚动条,那么可以用下面的方法:
void CThumbnailViewList::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp)
{
// TODO: Add your message handler code here and/or call default
ModifyStyle(WS_HSCROLL,0); // 强烈禁止
ShowScrollBar(SB_VERT,1); // 强烈打开
CListCtrl::OnNcCalcSize(bCalcValidRects, lpncsp);
}
例如有人碰到这样的问题:
Hello. I'm working with a CListCtrl on a property sheet, and am having a problem with window sizing and the scroll bars.When my list grows enough to need a vertical scroll, the window space taken by the vertical scroll causes the Control to also create a horizontal scroll. This works fine, but I'm wondering if there is a way to prevent the horizontal scroll from being there. I'd rather not have the horizontal scroll present at all.
他遇到的问题是:本来Report形式的列数是可以不需要水平滚动条的,但是由于竖直滚动条的出现,导致右边间距增大,从而也导致了水平滚动条的出现。
专家解答如下:
try this:
http://www.experts-exchange.com/Programming/Programming_Languages/MFC/Q_20874814.html
不过我还没试验过,下次有机会试验一下。
评论