作者共發了4篇帖子。 內容轉換:不轉換▼
 
點擊 回復
387 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)
 

本帖信息

點擊數:387 回複數:3
評論數: ?
作者:巨大八爪鱼
最後回復:巨大八爪鱼
最後回復時間:2016-1-11 21:48
 
©2010-2024 Arslanbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。