Vertical Scrollbar in CListCtrl

2019-03-01 21:11发布

I'm using a CListCtrl in Icon view, but it scrolls horizontally:

1 3 5 7 -->
2 4 6 8 -->

I'd rather it scroll horizontally:

1 2
3 4
5 6
| |
V V

Is there a way to do this?

3条回答
相关推荐>>
2楼-- · 2019-03-01 21:39

I seem to have resolved the issue by using a 'Report' view. Through the VS Designer this means changing the 'View' style to Report, resulting the control given the LVS_REPORT attribute in the .RC file. Note that this is equivalent to calling CListCtrl::SetView(LV_VIEW_DETAILS) in code. This isn't sufficient however. It is also necessary to create a column if you don't already have one with a couple lines of code:

m_lstScenarios.InsertColumn(0, L"NO HEADER");
m_lstScenarios.SetColumnWidth(k_nListColScenario, LVSCW_AUTOSIZE);

If you don't want the column header, set the LVS_NOCOLUMNHEADER in the Designer through the 'No Column Header' style.

查看更多
冷血范
3楼-- · 2019-03-01 21:41

In list control,to display content with image in single column with vertical scrollbar .add following code, In PreCreateWindow function,add following line cs.style |= (LVS_REPORT|LVS_NOCOLUMNHEADER); and in OnIntialUpdate function add following line, fileList.InsertColumn(0," ",LVCFMT_LEFT|LVCFMT_IMAGE,120,-1); ShowScrollBar(SB_VERT,1); after this,whereever you want to insert data in list you can but take care that you set imagelist and then insert data using insertitem eg: fileList,insertitem(0,"India",1); where 1-> is index of image in imagelist.

查看更多
【Aperson】
4楼-- · 2019-03-01 21:44

Change the Alignment style in designer from Left to Top.

查看更多
登录 后发表回答