MFC中CListCtrl的GetColumn在debug下正常,release下出错

问:
在对话框中使用ClistCtrl控件,view是Report
在初始化的时候加了几列,并设置了列标题。
在Debug下编译可以显示列标题,在Release下编译却不能。
    
    
    
    
CListCtrl * listControl = (CListCtrl * )GetDlgItem(IDC_LIST); LVCOLUMN listColumnTemp; CString columnTextTemp; columnTextTemp = _T( " Variable Name " ); listColumnTemp.pszText = columnTextTemp.GetBuffer(); listColumnTemp.mask = listColumnTemp.mask | LVCF_WIDTH | LVCF_FMT; listColumnTemp.fmt = LVCFMT_CENTER; listColumnTemp.cx = 100 ; listControl -> InsertColumn( 0 , & listColumnTemp); listColumnTemp.cx = 80 ; columnTextTemp = _T( " MIN " ); listColumnTemp.pszText = columnTextTemp.GetBuffer(); listControl -> InsertColumn( 1 , & listColumnTemp); columnTextTemp = _T( " MAX " ); listColumnTemp.pszText = columnTextTemp.GetBuffer(); listControl -> InsertColumn( 2 , & listColumnTemp); columnTextTemp = _T( " CONTOURS " ); listColumnTemp.pszText = columnTextTemp.GetBuffer(); listControl -> InsertColumn( 3 , & listColumnTemp); listControl -> SetExtendedStyle(listControl -> GetExtendedStyle() | LVS_EX_FULLROWSELECT );
  
  
  
  
答:
你没有设置LVCF_TEXT,将mask设置改为:
listColumnTemp.mask=listColumnTemp.mask|LVCF_WIDTH|LVCF_FMT|LVCF_TEXT

你可能感兴趣的:(MFC中CListCtrl的GetColumn在debug下正常,release下出错)