#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>
Opt("GUIOnEventMode", 1)
$main=GUICreate("My GUI",600,400,-1,-1) ; 创建一个居中显示的 GUI 窗口
;GUISetOnEvent($GUI_EVENT_CLOSE, "close")
;$Edit1 = GUICtrlCreateEdit("", 600, 00, -1,-1)
$text = GUICtrlCreateLabel("美丽的心情"&@CRLF&@CRLF&"速度激情"&@CRLF&@CRLF&"go go go",250,30,400,600)
$text2= GUICtrlCreateLabel("公告栏",250,10)
GUICtrlSetFont(-1, 10, 800, 0, "宋体")
$button =GUICtrlCreateButton("字体",20,20)
GUICtrlSetOnEvent(-1,"OKPressed")
$button2 =GUICtrlCreateButton("颜色",20,50)
GUIRegisterMsg($WM_SYSCOMMAND,"WM_SYSCOMMAND")
GUISetState(@SW_SHOW) ; 显示一个空白的窗口
ok()
; 运行界面,直到窗口被关闭
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func ok()
For $i=30 To 400 Step 5
$arr = ControlGetPos($main,"",3)
Sleep(500)
ControlMove("My GUI","",3,250,$i)
If $arr[1]>=390 Then
$i=30
EndIf
Next
EndFunc
Func OKPressed()
_ChooseFont("Arial", 8,"","","","",$text)
EndFunc
Func WM_SYSCOMMAND($hWndGUI, $MsgID, $WParam, $LParam)
Local Const $sc_close = 0xF060
If $hWndGUI = $main Then
Switch BitAND($WParam,0xFFF0)
Case $sc_close
Exit
EndSwitch
EndIf
Return $GUI_RUNDEFMSG
EndFunc
试了中断的方法去跳出循环,可是再使用Opt("GUIOnEventMode", 1)这种函数调用,当点击button后,再点击关闭主窗口发现窗口出现延时