c++ - Listview Control No column headers -


i'm developing c++ mfc application. there have list view control.

  1. i define control variable (m_listctrl) under clistctrl class ( resource view add variable )
  2. i add columns following code snippet

output

no column headers , columns. appreciated.

static void adddata(clistctrl &ctrl, int row, int col, const char *str) {     lvitem lv;     lv.iitem = row;     lv.isubitem = col;     lv.psztext = (lpstr)str;     lv.mask = lvif_text;     if (col == 0)         ctrl.insertitem(&lv);     else         ctrl.setitem(&lv); }   bool cmfctestdlg::oninitdialog() {     //.. default code in mfc dialog here             m_listctrl.insertcolumn(0, "page");     m_listctrl.setcolumnwidth(0, 60);      m_listctrl.insertcolumn(1, "last modified");     m_listctrl.setcolumnwidth(1, 80);      m_listctrl.insertcolumn(2, "prioirty");     m_listctrl.setcolumnwidth(2, 50);      m_listctrl.sendmessage(lvm_setextendedlistviewstyle, 0, lvs_ex_fullrowselect);      adddata(m_listctrl, 0, 0, "first");     adddata(m_listctrl, 0, 1, "jan 2011");     adddata(m_listctrl, 0, 2, "medium");      adddata(m_listctrl, 1, 0, "second");     adddata(m_listctrl, 1, 1, "feb 2011");     adddata(m_listctrl, 1, 2, "high");      return true;  // return true  unless set focus control } 

because have dialog template have set style headers there.

click on control in resource editor. make sure have style report selected (section appearance, property view).

in section appearance, set no column header no

if create list view own code, don't use style lvs_nocolumnheader

the style column header define negative. set style if want suppress header. other styles defined positiv, want them set style. sometime confusing.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -