0

I'm using win32 to create a list view with downloaded icons, however, the text is abbreviated at approximately 19 characters (as about size 12 font, Segoe UI). I have included the CreateWindow and item creation code I'm using for it.

Any advice would be appreciated.

HWND airlinelist = CreateWindow(WC_LISTVIEW,L"",WS_CHILD | LVS_LIST | WS_TABSTOP | WS_BORDER,18,104,323,74,hwnd,(HMENU)3,hinst,NULL);

                    LVITEM newi;
                    ZeroMemory(&newi,sizeof(LVITEM));                       
                    const wchar_t* n = L"Client Website Name, website.com"  
                    newi.pszText = newc;                            
                    newi.mask = LVIF_TEXT | LVIF_IMAGE;
                    newi.iImage = 0;                            
                    ListView_InsertItem(airlinelist,&newi); 

The above would create a list view with the icon and something to the effect of "Client Website Nam..." despite it only taking up half of the list view's width.

4

1 回答 1

0

我假设您正在使用LVS_LIST模式,因为样式显示在您的代码示例中。将项目添加到列表控件后,您可以使用该LVM_SETCOLUMNWIDTH消息调整列大小。您也可以使用ListView_SetColumnWidth宏。例如:

SendMessage(airlinelist, LVM_SETCOLUMNWIDTH, 0, 300);

这会将列设置为 300 像素宽。如果您实际使用LVS_REPORT模式,则需要单独设置每列的宽度。

于 2013-09-04T20:50:42.823 回答