MFC中的列表框控件(CListBox)可以通过以下方法添加int类型的数据:
CListBox listBox;
int value = 10;
CString strValue;
strValue.Format("%d", value);
listBox.AddString(strValue);
CListBox listBox;
int value = 10;
CString strValue;
strValue.Format("%d", value);
int index = 0; // 插入位置
listBox.InsertString(index, strValue);
注意:在添加int类型数据时,需要先将其转换为字符串类型,再添加到列表框中。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:mfc列表框显示数据的方法是什么