本文介绍了VC ++ SDI中的可编辑列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在VC ++中开发了一个SDI应用程序,用于在树视图(左侧)和列表视图(右侧)中显示文本文件。现在我想使列表视图可编辑。我想编辑列表视图中的每个单元格。任何人都可以帮助我或建议如何继续。提前致谢。以下是我的代码的一部分。
用于标记和解析字符串:
I have developed an SDI application in VC++ for displaying a text file in tree view (left side) and list view (right side). Now i want to make the list view editable. i want to edit each cell in the list view.Can any one please help me out or suggest something how to proceed. Thanks in advance. And below is the part of my code.
For tokenising and parsing the string:
void CLeftView::OnFileOpen()
{
// TODO: Add your command handler code here
CTreeCtrl& trCtrl = GetTreeCtrl();
HTREEITEM hItem,hsc;
CString pathname,strLine;
CString filename;
CFileDialog dlg(TRUE);
dlg.DoModal();
if(dlg.DoModal() == IDOK)
{
pathname=dlg.GetPathName(); // return full path and filename
}
CStdioFile File;
if(File.Open(pathname, CFile::modeRead)) // Open file to be read
{
while(File.ReadString(strLine)) // Read file
{
int Position = 0;
CString Token;
CAtlString str(strLine);
CAtlString resToken,resToken1;
resToken = str.Tokenize(_T("-:, "), Position);
if(resToken != (_T(""))) // Empty File Check
hItem = trCtrl.InsertItem(resToken , 0, 2 );
while(resToken!="")
{
_tprintf_s(_T("Token: %s\n"), resToken);
resToken = str.Tokenize(_T("-:, "), Position);
hsc = trCtrl.InsertItem(resToken , 0, 2 ,hItem);
resToken = str.Tokenize(_T("-:, "), Position);
trCtrl.InsertItem(resToken , 0, 2 ,hsc);
resToken = str.Tokenize(_T("-:, "), Position);
trCtrl.InsertItem(resToken , 0, 2 ,hsc);
}
}
}
推荐答案
这篇关于VC ++ SDI中的可编辑列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!