找回密码
 加入
搜索
查看: 1699|回复: 2

[GUI管理] 请教一下如何在窗口上设置一个浏览功能的button控件[已解决]

[复制链接]
发表于 2013-1-11 21:57:24 | 显示全部楼层 |阅读模式
本帖最后由 dpale 于 2013-1-12 22:23 编辑

起始位置固定在我的文档,指向新的文件目录并关闭后,可以记住最后一次指向的文件目录,这要如何实现呢
发表于 2013-1-12 18:40:07 | 显示全部楼层
demo

set.ini

[set]
documentfolder=My Documents
default=USERPROFILE
last=



#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Input1 = GUICtrlCreateInput("Input1", 40, 40, 417, 21)
$Button1 = GUICtrlCreateButton("Button1", 512, 32, 73, 41)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$defaultdir = EnvGet(IniRead(@ScriptDir & "\set.ini", "set", "default", "")) & "\" & IniRead(@ScriptDir & "\set.ini", "set", "documentfolder", "")
$lastdir = IniRead(@ScriptDir & "\set.ini", "set", "last", "")
If $lastdir = "" Then
$lastdir = $defaultdir
EndIf
GUICtrlSetData($Input1, $lastdir)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        IniWrite(@ScriptDir & "\set.ini", "set", "last", $lastdir)
                        Exit
                Case $Button1
                        $folder = FileSelectFolder("请选择目录", "")
                        If $folder <> "" Then
                                If $folder <> $lastdir Then
                                        $lastdir = $folder
                                        GUICtrlSetData($Input1, $lastdir)
                                EndIf
                        EndIf
        EndSwitch
WEnd
 楼主| 发表于 2013-1-12 22:19:19 | 显示全部楼层
回复 2# veket_linux


    非常感谢您的帮助,可以了,我自己来研究一下
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-18 23:54 , Processed in 0.077448 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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