In order to have a table like:
in my MFC dialog, I have added a List Control
to it.
And then with Add Variable
wizard, I have created this variable for the control:
public:
CListCtrl m_lstIDC_LIST1Control;
and then in the OnInitDialog
function of my dialog, I have added these lines of code:
// TODO: Add extra initialization here
m_lstIDC_LIST1Control.SetExtendedStyle(LVS_EX_FULLROWSELECT);
m_lstIDC_LIST1Control.SetExtendedStyle(LVS_EX_GRIDLINES);
//m_lstIDC_LIST1Control.SetExtendedStyle( LVS_SHOWSELALWAYS);
LVITEM lvItem;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
char* text = "Sandra C. Anschwitz";
wchar_t wtext[50];
mbstowcs(wtext, text, strlen(text)+1);
LPWSTR ptr = wtext;
lvItem.pszText = ptr;
m_lstIDC_LIST1Control.InsertItem(&lvItem);
UpdateData(false);
the result that I get is:
and if I uncomment the line:
//m_lstIDC_LIST1Control.SetExtendedStyle( LVS_SHOWSELALWAYS);
the horizontal grids will not be shown either!
So what's the problem?
Why the item that I have added is not shown?
what should I do in order to create a table like the one shown in the first picture?