找回密码
 加入
搜索
查看: 1407|回复: 4

怎样叫列表框里不自动排列,不按字母排列..

[复制链接]
发表于 2009-8-29 17:12:25 | 显示全部楼层 |阅读模式
怎样叫列表框里不自动排列,不按字母排列..
知道的老大帮帮小第啊谢谢了
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Dim $dir = "QQ.ini"
$Form1 = GUICreate("Form1", 301, 301, 192, 124)
$List1 = GUICtrlCreateList("", 65, 50, 180, 97)
$Input1 = GUICtrlCreateInput("", 108, 160, 120, 21, BitOR($ES_AUTOHSCROLL, $WS_BORDER))
$Input2 = GUICtrlCreateInput("", 108, 200, 120, 21, BitOR($ES_LOWERCASE, $ES_PASSWORD, $WS_BORDER))
$Label1 = GUICtrlCreateLabel("账号:", 50, 160, 52, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("密码:", 50, 200, 52, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("添加", 20, 250, 75, 25, $WS_GROUP)
$Button2 = GUICtrlCreateButton("删除", 115, 250, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("退出", 210, 250, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
refresh()

;~ GUICtrlSetData($List1, $xs)                      ;修改指定控件上的文本

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1   ;保存
                        save()
                Case $Button2   ;删除
                        del()
                Case $Button3   ;退出
                        Exit
        EndSwitch
WEnd

Func refresh()
        GUICtrlSetData($List1,"")          ;修改指定控件的数据
        $var = IniReadSectionNames($dir)   ;从某标准配置文件(*.ini)中读取所有字段的信息.
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $var[0]
                        GUICtrlSetData($List1, IniRead($dir, $var[$i], "zh", "Not Found"))
                                                ;修改指定控件的数据.从某标准配置文件(*.ini)中读取某个数值.

                Next
        EndIf
EndFunc   ;==>refresh

Func save()
        $i = 0
        While 1
                $i += 1
                IniReadSection($dir, "QQ" & $i)   ;从某标准配置文件(*.ini)中读取某个节中的所有关键字或值.

                If @error Then ExitLoop
        WEnd
        IniWrite($dir, "QQ" & $i, "zh", GUICtrlRead($Input1)) ;将读取到的值写入ini文件
        IniWrite($dir, "QQ" & $i, "mm", GUICtrlRead($Input2)) ;将读取到的值写入ini文件
        ;MsgBox(0,0,"保存成功")
        refresh()
EndFunc   ;==>save

Func del()
        $var = IniReadSectionNames($dir)
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $var[0]
                        If IniRead($dir, $var[$i], "zh", "Not Found") = GUICtrlRead($List1) Then
                                IniDelete($dir, $var[$i])
                                ;MsgBox(0, 0, "删除成功")
                                refresh()
                        EndIf
                Next
        EndIf
EndFunc   ;==>del

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-8-29 17:55:46 | 显示全部楼层
改一句就行了
$List1 = GUICtrlCreateList("", 65, 50, 180, 97, $WS_BORDER+$WS_VSCROLL)
 楼主| 发表于 2009-8-29 18:02:25 | 显示全部楼层
谢谢了,不过我现在弄好了,改成这样了。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2009-11-13 17:31:46 | 显示全部楼层
感谢~~ 我也在找这个 !!
发表于 2009-12-19 13:37:28 | 显示全部楼层
学习了,我也在找这样的样式。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-9 08:39 , Processed in 0.071427 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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