共用方式為


CListCtrl::InsertColumn

在清單檢視控制項插入新的資料行。

int InsertColumn( 
   int nCol, 
   const LVCOLUMN* pColumn  
); 
int InsertColumn( 
   int nCol, 
   LPCTSTR lpszColumnHeading, 
   int nFormat = LVCFMT_LEFT, 
   int nWidth = -1, 
   int nSubItem = -1  
);

參數

  • nCol
    新的資料行索引。

  • pColumn
    包含新資料行的屬性 LVCOLUMN 結構的位址。

  • lpszColumnHeading
    包含資料行標頭的字串的位址。

  • nFormat
    指定資料行的對齊方式的整數。 它可以是下列其中一個值: LVCFMT_LEFTLVCFMT_RIGHTLVCFMT_CENTER

  • nWidth
    資料行的寬度,以像素為單位)。 如果這個參數為-1 時,資料行寬度不會設定。

  • nSubItem
    子項目的索引與資料行。 如果這個參數為-1 時,子項目不與這個資料行。

傳回值

新的索引的資料行,如果成功或-1 則為。

備註

在清單檢視控制項最左欄一定是靠左對齊。

LVCOLUMN 結構在報表檢視包含資料行的屬性。 它也可用於取得有關資料行的相關資訊。 這個結構 Windows SDK在中說明。

需求

Header: afxcmn.h

請參閱

參考

CListCtrl 類別

階層架構圖表

CListCtrl::DeleteColumn