本帖最后由 水木子 于 2011-12-9 11:52 编辑
回复 1# 49666684
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListViewConstants.au3>
Global $avArray[3]
$avArray[0] = '张三|1117|23|13373736633|未婚'
$avArray[1] = '李四|1118|24|13363637373|未婚'
$avArray[2] = '王二|1119|24|13067855528|未婚'
GUICreate('', 500, 320)
GUICtrlCreateGroup("", 5, 5, 490, 310, -1, $WS_EX_TRANSPARENT)
GUICtrlCreateGroup("", 15, 15, 470, 230, -1, $WS_EX_TRANSPARENT)
$Tab1 = GUICtrlCreateTab(25, 30, 450, 210)
$TabSheet1 = GUICtrlCreateTabItem('')
$ListView1 = GUICtrlCreateListView("姓名 | 身份证号 | 年龄 |电话号码 | 婚否", 35, 40, 430, 190)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 58)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 58)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 80)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 80)
GUICtrlCreateGroup("", 15, 250, 470, 50)
$Input1 = GUICtrlCreateInput("", 30, 265, 200, 21)
$Button1 = GUICtrlCreateButton("确定", 290, 265, 75, 25)
$Button2 = GUICtrlCreateButton("取消", 390, 265, 75, 25)
GUISetState()
huoqu()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3, $Button2
Exit
Case $Button1
chazhao()
EndSwitch
WEnd
Func huoqu()
For $i = 0 To UBound($avArray) - 1
$aSplit = StringSplit($avArray[$i], '|')
GUICtrlCreateListViewItem($aSplit[1] & '|' & $aSplit[2] & '|' & StringRegExpReplace($aSplit[3], '.', '*') & '|' & StringRegExpReplace($aSplit[4], '.', '*') & '|' & $aSplit[5], $ListView1)
If Not @error Then
For $z = 0 To $aSplit[0]
$sBinary1 = StringToBinary($aSplit[1], 4)
$sBinary2 = StringToBinary($aSplit[2], 4)
Assign('!' & $sBinary1, '年龄:' & $aSplit[3] & @CRLF & '电话:' & $aSplit[4], 2)
Assign('!' & $sBinary2, '年龄:' & $aSplit[3] & @CRLF & '电话:' & $aSplit[4], 2)
Next
EndIf
Next
EndFunc ;==>huoqu
Func chazhao()
$sName = GUICtrlRead($Input1)
$a = Eval('!' & StringToBinary($sName, 4))
If $a Then
MsgBox(0, $sName, $a)
Else
MsgBox(48, '提示!', '没有搜索到相关信息')
EndIf
EndFunc ;==>chazhao
|