LVCOLUMN

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.
ValueDescription
LVCF_FMTThe fmt member is valid.
LVCF_IMAGEThe iImage member is valid.
LVCF_ORDERThe iOrder member is valid.
LVCF_SUBITEMThe iSubItem member is valid.
LVCF_TEXTThe pszText member is valid.
LVCF_WIDTHThe cx member is valid.


fmt
Alignment of the column heading and the subitem text in the column. It is one of the following values:
ValueDescription
LVCFMT_BITMAP_ON_RIGHTThe bitmap appears to the right of text. This does not affect an image from an image list assigned to the header item.
LVCFMT_CENTERText is centered.
LVCFMT_IMAGEThe item displays an image from an image list.
LVCFMT_LEFTText is left-aligned.
LVCFMT_RIGHTText is right-aligned.


The leftmost column in a list view control must be left aligned.

cx
Width of the column, in pixels.
pszText

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.

如果正在设置列信息,该成员是指向包含该列标题文本的空结尾字符串的指针。如果该结构正在接收该列的信息,该成员将指定接收该列标题文本的缓冲区的地址。

cchTextMax

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指向缓冲区的大小。如果该结构未接收有关列的信息,该成员将被忽略。

iSubItem
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.
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 onVersionsDefined inIncludeLink to
Windows CE OS2.0 and laterCommctrl.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
// 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);
}
            LVCOLUMN lvCol;
            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)
      .......

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值