目前共有4篇帖子。 内容转换:不转换▼
 
点击 回复
383 3
【庆祝】我终于成功地在ListView的平铺(Tile)视图上显示了灰色的详细信息文字
一派护法 十九级
1楼 发表于:2016-1-11 21:38

显示的灰色部分文字就是SubItems里面的。


一派护法 十九级
2楼 发表于:2016-1-11 21:40


一派护法 十九级
3楼 发表于:2016-1-11 21:43
【方法】
插入Item时,设置LV_ITEM结构体的mask,cColumns和puColumns成员变量即可。
请看示例:
    // Add items
    UINT columns[] = {1, 2}; // 显示第一、第二栏的内容
    LV_ITEM lvi;
    lvi.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_COLUMNS; // 加上LVIF_COLUMNS掩码
    lvi.iSubItem = 0; // 必须在创建主项目时设置
    lvi.cColumns = sizeof(columns) / sizeof(UINT); // 指定栏目数,这里是2
    lvi.puColumns = columns; // 指向数组columns的指针,这个数组无需动态创建
    for (i = 0; i < len; i++)
    {
        lvi.pszText = itemNames[i];
        lvi.iImage = i;
        lvi.iItem = i;
        ListView_InsertItem(ctrls.hListBox, &lvi);
    }
一派护法 十九级
4楼 发表于:2016-1-11 21:48
【MSDN参考资料】
链接:https://msdn.microsoft.com/en-us/library/windows/desktop/bb774760%28v=vs.85%29.aspx

cColumns
Type: UINT
Version 6.0
Number of data columns (subitems) to display for this item in tile view. The maximum value is 20. If this value is I_COLUMNSCALLBACK, the size of the column array and the array itself (puColumns) are obtained by sending a LVN_GETDISPINFO notification.
在平铺视图中以灰色文字显示的栏目数量,最大值为20。如果这个成员变量的值被设为I_COLUMNSCALLBACK的话,那么程序应该在LVN_GETDISPINFO消息中返回栏目数量以及具体的栏目编号数组。

puColumns
Type: PUINT
Version 6.0
A pointer to an array of column indices, specifying which columns are displayed for this item, and the order of those columns.
指向栏目编号的数组。栏目严格按数组中的顺序显示。


In tile view, the item name is displayed to the right of the icon. You can specify additional subitems (corresponding to columns in the details view), to be displayed on lines below the item name. The puColumns array contains the indices of subitems to be displayed. Indices should be greater than 0, because subitem 0, the item name, is already displayed. Column information can also be set in the LVTILEINFO structure when modifying the list item.
在平铺视图中,项目名称显示在图标的右边。你可以指定以灰色文字显示的详细信息。

回复帖子

内容:
用户名: 您目前是匿名发表
验证码:
(快捷键:Ctrl+Enter)
 

本帖信息

点击数:383 回复数:3
评论数: ?
作者:巨大八爪鱼
最后回复:巨大八爪鱼
最后回复时间:2016-1-11 21:48
 
©2010-2024 Arslanbar Ver2.0
除非另有声明,本站采用知识共享署名-相同方式共享 3.0 Unported许可协议进行许可。