如何在窗体中用OpenFileDialog加载图片
现在的问题是加载图片后不显示。哪位达达帮忙解决一下。谢谢。(刚入会没有几个金钱,请见谅)Opt("GUIOnEventMode", 1)
$MyGui = GUICreate('', 400, 300)
GUISetOnEvent(-3, '_GuiEvent')
$Button = GUICtrlCreateButton('加载图片', 260, 100, 80, 30)
GUICtrlSetOnEvent(-1, '_GuiEvent')
;$pic = GUICtrlCreatePic("E:\==素材\psb.jpg",100,100,80,80)
$pic = GUICtrlCreatePic("",100,100,80,80)
GUISetState()
While 1
Sleep(250)
WEnd
Func _GuiEvent()
Switch @GUI_CtrlId
Case -3
Exit
Case 3
GUISetState(65)
$f = FileOpenDialog('', '', '全部 (*.*)', 1 + 4, $MyGui)
GUISetState(64)
GUICtrlSetData($pic,$f)
EndSwitch
EndFunc ;==>_GuiEvent 已解决了。
#include <GUIConstantsEx.au3>
$MyGui = GUICreate('', 400, 300)
$Button = GUICtrlCreateButton('加载图片', 300, 30, 80, 30)
$pic = GUICtrlCreatePic("test.jpg",100,30,180,180)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $Button
$f = FileOpenDialog('', '', '全部 (*.*)', 1 + 4, $MyGui)
GUICtrlSetImage($pic,$f)
EndSwitch
WEnd
页:
[1]