回复 420# 131738
前辈需要的功能很简单的,至少比我以前那个简单多了,也因此少了很多判断 :)#include <GuiListView.au3>
;=======这里定义一个数组,以此来输出显示。该数组可以读取ini文件或其它方式组织
Local $Array_show[106] = [105]
For $i = 1 To $Array_show[0]
$Array_show[$i] = '显示项目' & $i
Next;===数组部分结束
Local $iChange = 20, $dqyc = 1 ;$iChange 每页显示多少个项目;$dqyc 为当前页次
Local $zys = Ceiling($Array_show[0] / $iChange)
GUICreate("Listview分页显示(页面独立)", 300, 250)
$ListView1 = GUICtrlCreateListView("编号|内容", 5, 5, 290, 185)
For $i = 1 To $iChange
GUICtrlCreateListViewItem($i & '|' & $Array_show[$i], $ListView1)
Next
$Button1 = GUICtrlCreateButton("<", 110, 200, 30, 22)
GUICtrlSetState(-1, 128)
$Button2 = GUICtrlCreateButton(">", 190, 200, 30, 22)
$Label = GUICtrlCreateLabel('1', 143, 205, 18, 17, 0x0002)
GUICtrlCreateLabel('/' & $zys, 162, 205, 23, 17)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Button1 ;上一页
Go($dqyc - 1)
Case $Button2 ;下一页
Go($dqyc + 1)
EndSwitch
WEnd
Func Go($yc)
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1)) ;删除所有项目
Local $x = ($yc - 1) * $iChange
Local $xend = $x + $iChange
If $xend > $Array_show[0] Then $xend = $Array_show[0] ;防止超出数组
For $i = $x + 1 To $xend
GUICtrlCreateListViewItem($i & '|' & $Array_show[$i], $ListView1)
Next
GUICtrlSetData($Label, $yc)
$dqyc = $yc
If $yc = $zys Then
GUICtrlSetState($Button1, 64)
GUICtrlSetState($Button2, 128)
ElseIf $yc = 1 Then
GUICtrlSetState($Button1, 128)
GUICtrlSetState($Button2, 64)
EndIf
EndFunc ;==>Go
|