找回密码
 加入
搜索
楼主: 410521a

[GUI管理] 谁能给个listview的分页显示的例子 ||||基本好了`非常感谢afan [已解决]

 火... [复制链接]
发表于 2010-6-30 17:08:41 | 显示全部楼层
回复 13# afan
还是前辈的代码够强大
发表于 2010-6-30 17:12:40 | 显示全部楼层
回复 16# 水木子


    我只是在你的代码基础上稍加装饰而已
 楼主| 发表于 2010-6-30 18:55:48 | 显示全部楼层
这个代码我基本上都看不懂
发表于 2010-6-30 18:59:01 | 显示全部楼层
回复 3# 水木子


    哎呀 生病了好啊 我都1年不知道生病啥滋味了代码很帅 收藏
 楼主| 发表于 2010-6-30 19:05:21 | 显示全部楼层
回复 19# nmgwddj


    这话可不能说``

评分

参与人数 1贡献 +1 收起 理由
afan + 1 :)

查看全部评分

 楼主| 发表于 2010-6-30 19:45:35 | 显示全部楼层
分页后 查找 只能查找当前页面怎么办?
发表于 2010-6-30 20:25:22 | 显示全部楼层
分页后 查找 只能查找当前页面怎么办?
410521a 发表于 2010-6-30 19:45



    查找就到ini里面查找撒
 楼主| 发表于 2010-6-30 20:33:26 | 显示全部楼层
去INI中查找`要把listview清空吗? 如何清空?
发表于 2010-6-30 22:08:42 | 显示全部楼层
回复 23# 410521a


    _GUICtrlListView_DeleteAllItems($ListView1)
这样就清空了。再把你搜索到的重新 GUICtrlCreateListViewItem() 生成
发表于 2010-6-30 23:49:43 | 显示全部楼层
回复 22# afan

武汉的。。。。。。。。。。。。
发表于 2010-6-30 23:51:26 | 显示全部楼层
回复  afan

武汉的。。。。。。。。。。。。
131738 发表于 2010-6-30 23:49



    ??? 夜深了,前辈讲梦话了
 楼主| 发表于 2010-7-1 13:35:07 | 显示全部楼层
我修改的`   $Combo  怎么不管用了?
发表于 2010-7-1 13:38:18 | 显示全部楼层
回复 27# 410521a


    我怎么知道你怎么修改的……
 楼主| 发表于 2010-7-1 14:04:15 | 显示全部楼层
$vas = IniReadSection($udata, '数据库')
If @error Then
MsgBox(48, "出错!", "数据库中还没有数据,系统为你添加了临时数据!"&@CRLF&"请重新运行程序")
IniWrite($udata,"数据库","测试","测试|测试|测试|添加数据后方可删除|此行,否则会出错!")
Exit
EndIf
Dim $iChange = 50, $dqyc = 1 ;$iChange 每页显示多少个项目;$dqyc 为当前页次
Dim $zys = Ceiling($vas[0][0] / $iChange)
Dim $zys1 = Ceiling($vas[0][0])

上边的代码我放到脚本的最上边

form1
............
form2
........


$Form5 = GUICreate("数据库管理", 483, 354,-1,-1,BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetIcon(@TempDir & "\ico.ico", -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$ListView5_1 = GUICtrlCreateListView("姓名|姓别|证件类型|证件编号|地址", 23, 24, 439, 230)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 235)
_GUICtrlListView_SetExtendedListViewStyle($ListView5_1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES));,复选框 $LVS_EX_CHECKBOXES))
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 63)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 60)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 130)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 4, 132)
$Label5_4 = GUICtrlCreateLabel("1", 104, 269, 15, 17, 0x0002)
GUICtrlCreateLabel('/' & $zys, 119, 269, 24, 17)
$Combo5_1 = GUICtrlCreateCombo("", 219, 266, 59, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
$Combodata = ''
For $i = 1 To $zys
        $Combodata &= '第' & $i & '页|'
Next
GUICtrlSetData(-1, $Combodata, '第1页')
$Button[15] = GUICtrlCreateButton("首页", 36, 264, 43, 25)
$Button[16] = GUICtrlCreateButton("<", 79, 264, 22, 25)
$Button[17] = GUICtrlCreateButton(">", 145, 264, 23, 25)
$Button[18] = GUICtrlCreateButton("尾页", 168, 264, 43, 25)
$Button[19] = GUICtrlCreateButton("复制", 298, 264, 51, 25)
$Button[14] = GUICtrlCreateButton("刷新", 35, 296, 75, 25)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button[9] = GUICtrlCreateButton("删除", 211, 296, 75, 25)
$Button[10] = GUICtrlCreateButton("修改", 123, 296, 75, 25)
$Button[11] = GUICtrlCreateButton("搜", 422, 296, 27, 25)
$Input5_1 = GUICtrlCreateInput("", 298, 298, 121, 21)
$Label5_1 = GUICtrlCreateLabel("数据:", 370, 270, 36, 17)
$Label5_2 = GUICtrlCreateLabel("0", 406, 270, 40, 16)
$Label5_3 = GUICtrlCreateLabel("By:陈伟东QQ:36951881", 298, 330, 164, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetState(-1, $GUI_DISABLE)
Dim $Form5_AccelTable[2][2] = [["{enter}", $Button[11]],["{NUMPADADD}", $Button[19]]]
GUISetAccelerators($Form5_AccelTable)

....................................
Func GUICtrlMsg()
        Switch @GUI_CtrlId       
Case $Combo5_1 ;下拉选择页次
                        Go(StringRegExpReplace(GUICtrlRead($Combo5_1), '[^\d]', ''))

        EndSwitch
EndFunc
................................................

Func Go($yc)
        Local $iNo1 = ($yc - 1) * $iChange + 1
        Local $iNo2
        If $yc = $zys Then
                $iNo2 = $vas[0][0]
                SetState(64, 128, 64, 128)
        ElseIf $yc = 1 Then
                $iNo2 = $iNo1 + $iChange - 1
                SetState(128, 64, 128, 64)
        Else
                $iNo2 = $iNo1 + $iChange - 1
                SetState(64, 64, 64, 64)
        EndIf
        Read($iNo1, $iNo2)
        GUICtrlSetData($Label5_4, $yc)
        GUICtrlSetData($Combo5_1, '第' & $yc & '页')
        $dqyc = $yc
EndFunc   ;==>Go

Func SetState($1, $2, $3, $4)
        GUICtrlSetState($Button[16], $1)
        GUICtrlSetState($Button[17], $2)
        GUICtrlSetState($Button[15], $3)
        GUICtrlSetState($Button[18], $4)
EndFunc   ;==>SetState

Func Read($iNo1, $iNo2)
        $z = 0+$zys1
        _GUICtrlListView_DeleteAllItems($ListView5_1)
        For $i = $iNo1 To $iNo2
                GUICtrlCreateListViewItem($vas[$i][1], $ListView5_1)
                                GUICtrlSetData($Label5_2,$z)
        Next
EndFunc   ;==>Read
 楼主| 发表于 2010-7-1 14:05:58 | 显示全部楼层
我晕` 我回复的贴又带关键字`了`` 快帮我审核下``  帮我看看
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-16 05:17 , Processed in 0.072464 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表