I have a CListCtrl control in my MFC project, I don't want the horizontal ScrollBar to be shown at any time. But the vertical one needs to be shown normally. I used VS2010, any solutions?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can do that by deriving your List control and having something like this:
void CListCtrlEx::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
{
ModifyStyle( WS_HSCROLL, 0 );
CListCtrl::OnNcCalcSize(bCalcValidRects, lpncsp);
}
Or if you don't want to derive your List control, you can do this:
if ( Style & WS_HSCROLL )
{
Style &= ~WS_HSCROLL;
::SetWindowLong(m_list.GetSafeHwnd(),GWL_STYLE,Style);
}