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

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

 火... [复制链接]
 楼主| 发表于 2010-7-1 14:39:11 | 显示全部楼层
快点审核吧``      能否把这个代码改为简单点的`` 这有点看不懂``
还有像这样的INI 能不能按名字查找?
14273019820212071x=王磊|男|shenfenzhen|14273019820212071x|上国
发表于 2010-7-1 15:08:08 | 显示全部楼层
afan真是高人!能不能收我为徒?
发表于 2010-7-1 15:14:28 | 显示全部楼层
afan真是高人!能不能收我为徒?
hzxymkb 发表于 2010-7-1 15:08

哇!哈哈!要是可以的话,随便把我也接收了吧!
 楼主| 发表于 2010-7-1 15:17:36 | 显示全部楼层
我很菜`` 有人收我吗?
 楼主| 发表于 2010-7-1 15:18:11 | 显示全部楼层
回复 32# hzxymkb


    帮我审核下贴子`回复``
发表于 2010-7-1 15:18:52 | 显示全部楼层
好吧 都拿我开心吧 只要大家开心就好
发表于 2010-7-1 15:20:21 | 显示全部楼层
回复 36# afan
我是真心拜师的!
发表于 2010-7-1 15:20:56 | 显示全部楼层
回复 35# 410521a
审核什么??能说明白一点吗?
发表于 2010-7-1 15:24:07 | 显示全部楼层
已经审过了
发表于 2010-7-1 15:26:38 | 显示全部楼层
收徒的话,我也报个名
 楼主| 发表于 2010-7-1 15:27:08 | 显示全部楼层
本帖最后由 410521a 于 2010-7-1 15:30 编辑

谢谢帮我审核
老师` 大叔们`大爷们`` 快帮我看看``     还有31楼的问题`


$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 15:29:24 | 显示全部楼层
好像存在着效率问题。
两位的代码中,Read函数在创新显示在新页中的数据时,总是会删除之前已经创建的数据。如果对数据的实时性要求不高,建议不用这种方法,毕竟在循环创建ListViewItem时是很浪费效率的。
发表于 2010-7-1 15:39:17 | 显示全部楼层
好像存在着效率问题。
两位的代码中,Read函数在创新显示在新页中的数据时,总是会删除之前已经创建的数据 ...
pusofalse 发表于 2010-7-1 15:29



    很有道理,感谢指正~!
 楼主| 发表于 2010-7-1 15:40:08 | 显示全部楼层
回复 43# afan


    师傅快帮帮我
发表于 2010-7-1 16:08:29 | 显示全部楼层
谢谢帮我审核
老师` 大叔们`大爷们`` 快帮我看看``     还有31楼的问题`


$vas = IniReadSection($uda ...
410521a 发表于 2010-7-1 15:27


你用的事件模式,创建的控件
$Combo5_1 = GUICtrlCreateCombo("", 219, 266, 59, 25, BitOR(0x0003,0x0040))
下面要加一句
GUICtrlSetOnEvent(-1, 'GUICtrlMsg')
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-15 15:46 , Processed in 0.071224 second(s), 14 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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