listview问题,无法修改列名 [英] listview problem, can't modify column name

查看:214
本文介绍了listview问题,无法修改列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个我无法解决的问题.

首先,我在listview控件中插入三列:

There is a problem i cant figured out.

First, i insert three column in a listview control:

LVCOLUMN lvc;
lvc.mask = LVCF_WIDTH/*|LVCF_TEXT*/;
lvc.cx = 100;
//lvc.pszText = _T("");
::SendMessage(hwndList, LVM_INSERTCOLUMN, 0, (LPARAM)&lvc);
lvc.cx = 100;
::SendMessage(hwndList, LVM_INSERTCOLUMN, 1, (LPARAM)&lvc);
lvc.cx = 100;
::SendMessage(hwndList, LVM_INSERTCOLUMN, 2, (LPARAM)&lvc);


其次,我要更改列的文本:


second, i want change the text of the column:

LVCOLUMN lvc = {0};
wchar_t buf[MAX_PATH];
lvc.mask = LVCF_TEXT;
lvc.pszText = buf;
g_LangMgr.GetString(IDS_USER, buf, MAX_PATH);//buf now is "i am wrong"
int ret = ::SendMessage(hwndList, LVM_SETCOLUMN, 0, (LPARAM)&lvc);


尽管ret等于1,表示可以,但是不会显示列文本.当我取消注释第一个代码片段中的代码时,它工作正常,并且我想知道在哪里?


although ret equals 1 which means ok, but the column text is not displayed. when i uncomment the code in the first code fragment, it worked ok, and i want know where?

推荐答案

,因为使用第一个代码创建了该列.如果创建时没有文本,则没有任何更改. :-O
because with first code you create the column. If its is created without text you havent anything to change. :-O


这篇关于listview问题,无法修改列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆