創(chuàng)建圖標(biāo)(Icon)控件.
GUICtrlCreateIcon ( 文件名, 圖標(biāo)名, 左距, 頂距 [, 寬度 [,
高度 [, 樣式 [, 擴(kuò)展樣式]]]] )
文件名 | 圖標(biāo)文件名稱. |
圖標(biāo)名 | 圖標(biāo)名稱, 如果圖標(biāo)文件含有多個(gè)圖標(biāo), 則指定圖標(biāo)標(biāo)識符(序號,使用負(fù)數(shù)), 否則使用 -1. |
左距 | 控件左側(cè)的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計(jì)算左側(cè)位置. |
頂距 | 控件上方的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計(jì)算頂部位置. |
寬度 | [可選參數(shù)] 控件的寬度(默認(rèn) 32). |
高度 | [可選參數(shù)] 控件的高度(默認(rèn) 32). |
樣式 | [可選參數(shù)] 控件的樣式. 查看附錄 GUI 控件樣式表. 默認(rèn)樣式 ( -1) : $SS_NOTIFY 強(qiáng)制樣式 : $WS_TABSTOP, $SS_ICON |
擴(kuò)展樣式 | [可選參數(shù)] 控件的擴(kuò)展樣式. 查看附錄 擴(kuò)展樣式表. |
成功: | 返回控件標(biāo)識符(控件ID). |
失敗: | 返回 0. |
#include <GUIConstantsEx.au3>
Example1()
Example2()
; 示例 1 ---------------------------
Func Example1()
GUICreate("我的圖標(biāo) GUI", 250, 250)
GUICtrlCreateIcon("shell32.dll", 10, 20, 20)
GUICtrlCreateIcon(@WindowsDir & "\cursors\horse.ani",
-1, 20,
40, 32, 32)
GUICtrlCreateIcon("shell32.dll", 7, 20, 75, 32, 32)
GUISetState()
; 運(yùn)行 GUI, 直到
GUI 被關(guān)閉
While
1
Local $msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
EndFunc ;==>Example1
; 示例 2 ---------------------------
Func Example2()
Local
$iOldOpt,
$n1, $n2, $a, $b
$iOldOpt = Opt("GUICoordMode", 1)
GUICreate("我的圖標(biāo)動畫 GUI", 350, 74, -1,
-1)
GUICtrlCreateLabel("", 331, 0, 1, 74, 5)
$n1
= GUICtrlCreateIcon(@WindowsDir & "\cursors\aero_working.ani",
-1, 0,
0, 32, 32); 譯注:
Win7
$n2
= GUICtrlCreateIcon(@WindowsDir & "\cursors\aero_working_l.ani",
-1, 0,
40, 32, 32); 譯注:
Win7
;$n1 =
GUICtrlCreateIcon(@WindowsDir & "\cursors\dinosaur.ani", -1, 0,
0, 32, 32);譯注: 支持 Win xp
;$n2 =
GUICtrlCreateIcon(@WindowsDir & "\cursors\horse.ani", -1, 0,
40, 32, 32);譯注: 支持 Win xp
GUISetState(@SW_SHOW)
$a
= 0
$b
= 0
While
($a < 300) And ($b < 300)
$a = $a
+ Int(Random(0,
1) + 0.5)
$b = $b
+ Int(Random(0,
1) + 0.5)
GUICtrlSetPos($n1, $a, 0)
GUICtrlSetPos($n2, $b, 40)
Sleep(20)
WEnd
Sleep(1000)
Opt("GUICoordMode", $iOldOpt)
EndFunc ;==>Example2
provider with jb51.net (unicode) |