Home > Back-end >  The basis of problems related to the MFC
The basis of problems related to the MFC

Time:02-13

C + + MFC, how to write a program to the list box to add content?

CodePudding user response:

 CListCtrl m_ListCtrl; 
M_ListCtrl. InsertColumn (0, "the first column", NULL, 100, 1);
M_ListCtrl. InsertColumn (1, "the second column", NULL, 100, 1);
LV_ITEM lvItem;
LvItem. Mask=LVIF_TEXT;
LvItem. The iItem=0;//first line
LvItem. ISubItem=0;
LvItem. PszText="the value of the first line of the first column";
M_ListCtrl. InsertItem (& amp; LvItem);
M_ListCtrl. SetItemText (0, 1, "the value of the first line of the second column");


CodePudding user response:

reference 1/f, zhao teacher reply:
 CListCtrl m_ListCtrl; 
M_ListCtrl. InsertColumn (0, "the first column", NULL, 100, 1);
M_ListCtrl. InsertColumn (1, "the second column", NULL, 100, 1);
LV_ITEM lvItem;
LvItem. Mask=LVIF_TEXT;
LvItem. The iItem=0;//first line
LvItem. ISubItem=0;
LvItem. PszText="the value of the first line of the first column";
M_ListCtrl. InsertItem (& amp; LvItem);
M_ListCtrl. SetItemText (0, 1, "the value of the first line of the second column");


eldest brother eldest brother, how do I put this code into the program? Can you screenshot

CodePudding user response:

reference 1/f, zhao teacher reply:
 CListCtrl m_ListCtrl; 
M_ListCtrl. InsertColumn (0, "the first column", NULL, 100, 1);
M_ListCtrl. InsertColumn (1, "the second column", NULL, 100, 1);
LV_ITEM lvItem;
LvItem. Mask=LVIF_TEXT;
LvItem. The iItem=0;//first line
LvItem. ISubItem=0;
LvItem. PszText="the value of the first line of the first column";
M_ListCtrl. InsertItem (& amp; LvItem);
M_ListCtrl. SetItemText (0, 1, "the value of the first line of the second column");


eldest brother, if I were in OnInitDIalog () function, how to write?

CodePudding user response:

Try baidu search "MFC OnInitDIalog CListCtrl InsertColumn InsertItem"

CodePudding user response:

quoted zhao 4, 4/f, the teacher's reply:
try baidu search "MFC OnInitDIalog CListCtrl InsertColumn InsertItem"
ok, thank you
  • Related