0

我正在ListView使用 pure win32 api。但是当我设置ListView平铺视图时。那么子项目不会出现在项目旁边。我的代码如下:

ListView_SetView(m_hwndListview,LV_VIEW_TILE);
//Set tile view info
SIZE size = { 150, 75 };
LVTILEVIEWINFO tileViewInfo = {0};

tileViewInfo.cbSize   = sizeof(tileViewInfo);
tileViewInfo.dwFlags  = LVTVIF_FIXEDSIZE;
tileViewInfo.dwMask   = LVTVIM_COLUMNS | LVTVIM_TILESIZE;
tileViewInfo.cLines   = 3;
tileViewInfo.sizeTile = size;

//Set tile info
LVTILEINFO lvti = {0};
int order[2];
order[0]=2;
order[1]=1;
lvti.cbSize = sizeof(LVTILEINFO);
lvti.iItem = 0;
lvti.cColumns = 2;
lvti.piColFmt =  LVCFMT_LEFT;
lvti.puColumns = PUINT(order);

ListView_SetTileInfo(m_hwndListview, &lvti);
ListView_SetTileViewInfo(m_hwndListview, &tileViewInfo);

有谁知道解决这个问题?非常感谢!

4

1 回答 1

0

lvti.piColFmt应该是指向列格式值数组的指针,而不是单个值。在你的情况下,它可能是这样的:

int colfmt[2];
colfmt[0] = LVCFMT_LEFT;
colfmt[1] = LVCFMT_LEFT;
lvti.piColFmt = colfmt;

希望有帮助!

于 2013-10-29T21:32:26.120 回答