|
楼主 |
发表于 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 |
|