点击或拖拽改变大小

ListView.AddItem 方法

X#
在列表视图的最后添加一个新的 ListViewItem 对象。

命名空间:  XSharp.VO.SDK
程序集:  XSharp.VOGUIClasses (在 XSharp.VOGUIClasses.dll 中) 版本:2.22 GA
语法
 VIRTUAL METHOD AddItem(
	oListViewItem AS ListViewItem
) AS USUAL
查看代码

参数

oListViewItem
类型:ListViewItem
要添加到列表视图的 ListViewItem 对象。

返回值

类型:__Usual
如果成功添加项目,则为 TRUE;否则为 FALSE。
示例
下面的示例显示了如何填充一个 ListView 控件。请注意,它还在每个项目中存储了记录编号,以便在选择任何给定项目时稍后检索:
X#
 1LOCAL cCoachName AS string
 2LOCAL oItem AS ListViewItem
 3
 4DO WHILE !SELF:oCoachesServer:eof
 5    cCoachName := Trim( SELF:oCoachesServer:FIELDGET( #LastName ) ) + ", " + ;
 6                  Trim( SELF:oCoachesServer:FIELDGET( #FirstName ) ) + " " + ;
 7                  SELF:oCoachesServer:FIELDGET( #MiddleInit )
 8    oItem:SetText( SELF:oCoachesServer:FIELDGET( #Season ),     #cSeason )
 9    oItem:SetValue( SELF:oCoachesServer:RecNo,                  #cCoachName )
10    oItem:SetText( CoachName,                                   #cCoachName )
11    oItem:SetText( SELF:oCoachesServer:FIELDGET( #Gender ),     #cGender )
12    oItem:SetText( SELF:oCoachesServer:FIELDGET( #ClubCode ),   #cClubCode )
13    oItem:SetText( SELF:oCoachesServer:FIELDGET( #TeamNr ),     #cTeamNr )
14    oItem:SetText( SELF:oCoachesServer:FIELDGET( #HomePhone ),  #cHomePhone )
15    oItem:SetText( SELF:oCoachesServer:FIELDGET( #WorkPhone ),  #cWorkPhone )
16
17    SELF:oDClvCoaches:AddItem( oItem )
18    SELF:oCoachesServer:skip()
19ENDDO
参见