本帖最后由 jycel 于 2009-10-18 15:11 编辑
OK解决了!应该还有其它方法!下来慢慢研究!
代码如下:
#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Local $_INI_File = @ScriptDir & "\Image.ini";读取配置文件
if not FileExists($_INI_File) then
msgbox(16,"错误提示","未找到Image.ini配置文件"&@CRLF&"请手动建立"&@CRLF&"字段名为[历史]",5)
Exit
EndIf
#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\桌面\Form1.kxf
$Form1 = GUICreate("图片查看器", 587, 373, 216, 186)
GUISetOnEvent($GUI_EVENT_CLOSE, "Event")
$Group1 = GUICtrlCreateGroup("", 2, 0, 468, 369)
$Pic1 = GUICtrlCreatePic("", 8, 8, 457, 353)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 472, 0, 113, 369)
$TreeView1 = GUICtrlCreateTreeView(480, 14, 97, 321)
GUICtrlSetOnEvent(-1, "Event")
$Button1 = GUICtrlCreateButton("退出查看器", 480, 344, 97, 20, -1, $WS_EX_STATICEDGE)
GUICtrlSetOnEvent(-1, "Event")
$item=GUICtrlCreateTreeViewItem("历史图片", $TreeView1)
$IniSection = IniReadSection($_INI_File, "历史");读取配置文件主值
if not @error Then
For $i = 1 To $IniSection[0][0]
$datez=GUICtrlCreateTreeViewItem($IniSection[$i][0],$item)
GUICtrlSetOnEvent(-1, "Event")
Next
EndIf
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(100)
WEnd
Func Event()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
case $Button1
Exit
Case Else
$Val = GUICtrlRead(@GUI_CtrlId,1)
$Val = StringReplace ( $Val, "|","")
GUICtrlSetImage($Pic1,IniRead($_INI_File,"历史",$Val,""))
EndSwitch
EndFunc
|