简体   繁体   English

CListCtrl CListCtrl仅显示填充的行吗?

[英]CListCtrl Does CListCtrl display only filled rows?

Is the default behaviour for CListCtrl to only show the number of rows that are currently filled with an empty greyed out area beneath? CListCtrl的默认行为是仅显示当前下面填充有一个灰色空白区域的行数吗?

In my List I have a variable number of entries in a fixed display area. 在我的列表中,固定显示区域中的条目数是可变的。 When there are more entries than the display area can hold it is fine, the vertical slider comes up and everything displays correctly. 当条目数超出显示区域的容纳范围时,垂直滑块会出现,并且所有显示均正确。 When I delete entries so there are not enough now to fill the display area, the empty area at the bottom becomes greyed out with no cell grid. 当我删除条目以至于现在没有足够的空间来填充显示区域时,底部的空白区域变为灰色,没有单元格。

I want to keep the display area set out as a complete cell grid. 我想将显示区域设置为完整的单元格网格。 I can calculate and top up that area with empty rows if I have to but I wouldn't have expected this to be the default behaviour. 如果需要的话,我可以用空行计算并加满该区域,但我不希望这是默认的行为。 I would have expected the whole Client area of the CListCtrl to stay permanently displayed as an empty cell grid with the correct number of entries displayed at the top. 我希望CListCtrl的整个Client区域永久显示为一个空单元格,并在顶部显示正确的条目数。

Do I have to handle this manually or is there perhaps some property of the CListCtrl I am not setting? 我是否必须手动处理此问题,或者我是否未设置CListCtrl的某些属性?

What you have described IS the default behavior of the List View control: 你所描述的列表视图控件的默认行为:

列表视图控件

Here is the relevant code fragment: 这是相关的代码片段:

m_List.InsertColumn(0, L"Col 1", 0, 100);
m_List.InsertColumn(1, L"Col 2", 0, 100);
m_List.InsertItem(0, L"Item 1");
m_List.InsertItem(1, L"Item 2");
ListView_SetExtendedListViewStyle(m_List, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);

You just need to make sure that you use current version of the Common Controls. 您只需要确保使用当前版本的通用控件即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM