本文介绍了在列表控件中获取列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!



我有一个列表控件-报告视图,具有3列.如何获取列名?我尝试了GetColumn().但是它没有返回值.
代码部分如下所示.

Hi,

I am having a list control - report view, with 3 columns. How can i get the column name? I tried GetColumn(). But it is not returning the value.
The code part is shown below.

LVCOLUMN lvColInfo ;
ZeroMemory(&lvColInfo, sizeof(lvColInfo));
m_MyListCtrl.GetColumn(0, &lvColInfo);

推荐答案

TCHAR szName[128]; // This is the buffer where the name will be stored
LVCOLUMN lvColInfo;
ZeroMemory(&lvColInfo, sizeof(lvColInfo)); // This line is not really needed and you can remove it
lvColInfo.mask = LVCF_TEXT;
lvColInfo.pszText = szName;
lvColInfo.cchTextMax = _countof(szName);
m_MyListCtrl.GetColumn(0, &lvColInfo);


const INT SIZE = 0x100;
TCHAR szText[SIZE];
LVCOLUMN lvColInfo ;
ZeroMemory(&lvColInfo, sizeof(lvColInfo));
lvColInfo.pszText = szText;
lvColInfo.cchTextMax = SIZE;
lvColInfo.mask = LVCF_TEXT;
m_MyListCtrl.GetColumn(0, &lvColInfo);


这篇关于在列表控件中获取列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 20:35