InsertItem的用法 clistctrl insertitem

InsertItem的用法 clistctrl insertitem

InsertItem

  用于MFC中CListCtrl控件加入列表项。  函数原型如下:  int InsertItem( const LVITEM* pItem );  int InsertItem( int nItem, LPCTSTR lpszItem );  int InsertItem( int nItem, LPCTSTR lpszItem, int nImage );  int InsertItem( UINT nMask, int nItem, LPCTSTR lpszItem, UINTnState, UINT nStateMask, int nImage, LPARAM lParam );  其中,nItem是控件中行的索引 、lpszItem是控件头的名字。  一般我们用的比较多的是第二种和第三种,其中第三种是建立一个带有头标的项。  Return Value  The index of the new item if successful or -1 otherwise.  Parameters  pItem  Pointer to anLVITEM structure that specifies the item’sattributes, as described in thePlatformSDK.  nItem  Index of the item to be inserted.  lpszItem  Address of a string containing the item’s label, orLPSTR_TEXTCALLBACKifthe item is a callback item. For information on callback items, seeCListCtrl::GetCallbackMask.  nImage  Index of the item’s image, orI_IMAGECALLBACKifthe item is a callback item. For information on callback items, seeCListCtrl::GetCallbackMask.  nMask  ThenMaskparameterspecifies which item attributes passed as parameters are valid. Itcan be one or more of themaskvaluesdescribed inLVITEM structure in thePlatformSDK. The valid values can be combined with thebitwiseORoperator.  nState  Indicates the item's state, state image, and overlay image. SeethePlatformSDKtopicsLVITEMformore information andList View Item States for a list of validflags.  nStateMask  Indicates which bits of the state member will be retrieved ormodified. SeeLVITEMinthePlatformSDKfor moreinformation.  nImage  Index of the item’s image within the image list.  lParam  A 32-bit application-specific va lue associated with the item. Ifthis parameter is specified, you must setthenMaskattributeLVIF_PARAM.  Remarks  Inserts an item into the list view control.  Example  // The pointer to my list view control. extern CListCtrl*pmyListCtrl;CString strText; int nColumnCount =pmyListCtrl->GetHeaderCtrl()->GetItemCount();// Insert 10 items in the list view control.for (int i=0;i< 10;i++){ strText.Format(TEXT("item %d"), i); //Insert the item, select every other item.pmyListCtrl->InsertItem( LVIF_TEXT|LVIF_STATE, i,strText, (i%2)==0 ? LVIS_SELECTED : 0, LVIS_SELECTED, 0, 0); //Initialize the text of the subitems. for (int j=1;j< nColumnCount;j++) { strText.Format(TEXT("sub-item%d %d"), i, j); pmyListCtrl->SetItemText(i, j,strText); }}

  

爱华网本文地址 » http://www.aihuau.com/a/25101016/293727.html

更多阅读

的地得的用法 的和地的区别及用法

的地得的用法——简介日常工作中,常会有人提到“的”“地”“得”用法的问题,不少学生对“的、地、得”用法也是含糊不清,乱用一气,作业自然会在“的”“地”“得”用法上出错,并且屡改屡犯。大家都知道,“的”、“地”、“得”这三个字的

眼线膏的用法画出迷人眼线 美宝莲眼线膏

眼线膏的用法画出迷人眼线——简介美眉们一般都习惯用眼线笔来画眼线,今天小编要在这里教大家如何用眼线膏来描画眼线,步骤很简单,想要画好眼妆的美眉们,赶紧准备好工具,跟小编一起来学习吧!眼线膏的用法画出迷人眼线——工具/原料

护发素的用法 护发素发膜的正确用法

护发素的用法——简介护发素可以为头发提供一层保护,或许就因此得名了吧。比起洗发用品,护发素能够令头发看起来更自然和健康。 下面来介绍一下护发素的用法供参考。 护发素的用法——工具/原料护发素护发素的用法——方法/步骤护发

各种化妆刷的用法 如何使用彩妆

各种化妆刷的用法——简介来了解各种化妆刷的用法吧各种化妆刷的用法——方法/步骤各种化妆刷的用法 1、用平头眼影刷沾取少量眼影,从睫毛根部开始徐徐向上淡开,注意层次过渡均匀,刚开始训练以清淡为宜。(精选动物毛的扁平轻薄的刷头可

卫生棉条的用法 短导管卫生棉条的用法

卫生棉条的用法——简介卫生棉棉条,有称卫生栓,简称棉条,是一种棉质的圆柱体,在女性月经来潮时,可置入阴道中吸收经血。一个卫生棉条使用用者,一生中使用的卫生棉条可能超过10,000个。卫生棉条为众多女性提供了极大的便利,但是你知道卫生棉

声明:《InsertItem的用法 clistctrl insertitem》为网友仰起头不流泪分享!如侵犯到您的合法权益请联系我们删除