gpt4 book ai didi

c++ - 如何将项目插入到 CListCtrl 中的第二列

转载 作者:太空宇宙 更新时间:2023-11-04 14:13:08 25 4
gpt4 key购买 nike

我是 MFC 和 BGCControlBar 的新手。
现在我打算使用 CBCGPListCtrl 定义为:

class BCGCBPRODLLEXPORT CBCGPListCtrl : public CListCtrl

&

CBCGPListCtrl m_wndWatch;

现在在我打算更改的演示代码中:

int CWatchBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
if (CBCGPDockingControlBar::OnCreate(lpCreateStruct) == -1)
return -1;

m_Font.CreateStockObject (DEFAULT_GUI_FONT);

CRect rectDummy;
rectDummy.SetRectEmpty ();

// Create output pane:
const DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_VSCROLL | LVS_REPORT | LVS_EDITLABELS ;

m_wndWatch.Create (dwStyle, rectDummy, this, ID_LIST_1);
m_wndWatch.SendMessage (LVM_SETEXTENDEDLISTVIEWSTYLE, 0,
LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
m_wndWatch.InsertColumn (0, _T("Variable"), LVCFMT_LEFT, 100);
m_wndWatch.InsertColumn (1, _T("Value"), LVCFMT_LEFT, 100);

m_wndWatch.InsertItem (0, _T("m_nCount"));
m_wndWatch.SetItemText (0, 1, _T("100"));

m_wndWatch.SetFont (&m_Font);

return 0;
}

我得到的是一个列表(如图),我只能编辑第一列,数据不能保留。 如何编辑第二列文本并使数据可保留?

enter image description here

最佳答案

您需要一个网格控件而不是 CListCtrl(或派生类)。实际上,可以在其他专栏中添加对版本的支持,但这是一项很麻烦的工作,而不是我推荐给新手的那种东西。

根据 this page of their web site , 他们有一个网格控件。

关于c++ - 如何将项目插入到 CListCtrl 中的第二列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13150209/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com