LVCOLUMN
This structure contains information about a column in report view. This structure is used both for creating columns and manipulating them using messages. The structure was extended to support new mask values. Two new members, iOrder and iImage, were added to support the new mask values.
typedef struct _LVCOLUMN { UINT mask; int fmt; int cx; LPTSTR pszText; int cchTextMax; int iSubItem; int iOrder; int iImage;} LVCOLUMN;
Members
-
mask
-
Specifies which members contain valid information. It can be zero, or one or more of the following values.
Value Description LVCF_FMT The fmt member is valid. LVCF_IMAGE The iImage member is valid. LVCF_ORDER The iOrder member is valid. LVCF_SUBITEM The iSubItem member is valid. LVCF_TEXT The pszText member is valid. LVCF_WIDTH The cx member is valid.
fmt
-
Alignment of the column heading and the subitem text in the column. It is one of the following values:
Value Description LVCFMT_BITMAP_ON_RIGHT The bitmap appears to the right of text. This does not affect an image from an image list assigned to the header item. LVCFMT_CENTER Text is centered. LVCFMT_IMAGE The item displays an image from an image list. LVCFMT_LEFT Text is left-aligned. LVCFMT_RIGHT Text is right-aligned.
The leftmost column in a list view control must be left aligned.
cx
- Width of the column, in pixels. pszText
- Index of subitem associated with the column. iOrder
- Zero-based column offset. Column offset is with left-to-right order. For example, zero indicates the leftmost column. iImage
- Zero-based index of an image within the image list. The specified image will appear within the column.
If column information is being set, this member is the pointer to a null-terminated string that contains the column heading text. If the structure is receiving information about a column, this member specifies the address of the buffer that receives the column heading text.
如果正在设置列信息,该成员是指向包含该列标题文本的空结尾字符串的指针。如果该结构正在接收该列的信息,该成员将指定接收该列标题文本的缓冲区的地址。
Size of the buffer pointed to by the pszText member. If the structure is not receiving information about a column, this member is ignored.
由成员pszText指向缓冲区的大小。如果该结构未接收有关列的信息,该成员将被忽略。
Remarks
This structure supersedes the LV_COLUMN structure.
This structure is used with the LVM_GETCOLUMN, LVM_SETCOLUMN, LVM_INSERTCOLUMN, and LVM_DELETECOLUMN messages.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 2.0 and later | Commctrl.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
CListCtrl::GetColumn
This method retrieves the attributes of a column in a list view control.
The LVCOLUMN structure contains information about a column in report view.
BOOL GetColumn( int nCol, LVCOLUMN* pColumn ) const;
Parameters
-
nCol
- Specifies the index of the column whose attributes are to be retrieved. pColumn
- Address of an LVCOLUMN structure that specifies the information to retrieve and receives information about the column. The mask member specifies which column attributes to retrieve. If the mask member specifies the LVCF_TEXT value, the pszText member must contain the address of the buffer that receives the item text and the cchTextMax member must specify the size of the buffer.
-
指定信息检索和接收有关栏目信息的一个lvcolumn结构体地址。mask成员指定要检索的列属性。如果mask成员指定lvcf_text值,成员pszText中必须包含接收项目文本和cchTextMax成员缓冲地址必须指定的缓冲区大小。
Return Value
Nonzero if it is successful; otherwise, it is zero.
Example
LVCOLUMN lvCol;// Pointer to the list view control. CListCtrl* pmyListCtrl; LVCOLUMN col; col.mask = LVCF_WIDTH; // Double the column width of the first column. if (pmyListCtrl->GetColumn(0, &col)) { col.cx *= 2; pmyListCtrl->SetColumn(0, &col); }
CString strColName;
int i;
sSql = " CREATE TABLE temp( ";
strInsert = " INSERT INTO temp( " ;
lvCol.mask = LVCF_TEXT|LVCF_IMAGE|LVCF_FMT|LVCF_ORDER;
lvCol.fmt = LVCFMT_LEFT | LVCFMT_IMAGE;
lvCol.cchTextMax = 256; //必设,如果mask成员指定lvcf_text值,成员pszText中必须包含接收项目文本和cchTextMax成员缓冲地址必须指定的缓冲区大小。
lvCol.pszText = strColName.GetBuffer(256); //必设,pszText 所指向的字符串的实际存储位置。
m_ListCtrl.GetColumn(i,&lvCol).......