創(chuàng)建日期控件.
GUICtrlCreateDate ( "文本", 左距, 頂距 [, 寬度 [, 高度
[, 樣式 [, 擴(kuò)展樣式]]]] )
文本 | 預(yù)選的日期.(總是為 "yyyy/mm/dd" 格式). |
左距 | 控件左側(cè)的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計(jì)算左側(cè)位置. |
頂距 | 控件上方的位置. 若此值為 -1, 則根據(jù) GUICoordMode 的設(shè)置計(jì)算頂部位置. |
寬度 | [可選參數(shù)] 控件的寬度(默認(rèn)使用先前的寬度). |
高度 | [可選參數(shù)] 控件的高度(默認(rèn)使用先前的高度). |
樣式 | [可選參數(shù)] 控件的樣式. 查看附錄 GUI
控件樣式表. 默認(rèn)樣式 (-1) : $DTS_LONGDATEFORMAT 強(qiáng)制樣式 : $WS_TABSTOP |
擴(kuò)展樣式 | [可選參數(shù)] 控件的擴(kuò)展樣式. 查看附錄 擴(kuò)展樣式表. 默認(rèn)擴(kuò)展樣式 (-1) : WS_EX_CLIENTEDGE |
成功: | 返回控件標(biāo)識(shí)符(控件ID). |
失敗: | 返回 0. |
#include <GUIConstantsEx.au3>
#include <DateTimeConstants.au3>
Example1()
Example2()
Example3()
Example4()
; 示例 1
Func Example1()
Local
$date, $msg
GUICreate("獲取日期 GUI", 200, 200, 800, 200)
$date
= GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20)
GUISetState()
; 運(yùn)行 GUI, 直到
GUI 被關(guān)閉
Do
$msg = GUIGetMsg()
Until
$msg = $GUI_EVENT_CLOSE
MsgBox(0, "日期", GUICtrlRead($date))
GUIDelete()
EndFunc ;==>Example1
; 示例 2
Func Example2()
Local
$n, $msg
GUICreate("獲取日期 GUI", 200, 200, 800, 200)
$n
= GUICtrlCreateDate("", 10, 10, 100, 20, $DTS_SHORTDATEFORMAT)
GUISetState()
; 運(yùn)行 GUI, 直到
GUI 被關(guān)閉
Do
$msg = GUIGetMsg()
Until
$msg = $GUI_EVENT_CLOSE
MsgBox(0, "日期", GUICtrlRead($n))
GUIDelete()
EndFunc ;==>Example2
; 示例 3
Func Example3()
Local
$date, $DTM_SETFORMAT_, $style
GUICreate("獲取日期 GUI", 200, 200, 800, 200)
$date
= GUICtrlCreateDate("1953/04/25", 10, 10, 185, 20)
;
設(shè)置默認(rèn)日期時(shí)間格式
$DTM_SETFORMAT_ = 0x1032 ; $DTM_SETFORMATW
$style = "yyyy/MM/dd HH:mm:ss"
GUICtrlSendMsg($date, $DTM_SETFORMAT_, 0, $style)
GUISetState()
While
GUIGetMsg()
<> $GUI_EVENT_CLOSE
WEnd
MsgBox(0, "時(shí)間", GUICtrlRead($date))
EndFunc ;==>Example3
; 示例 4
Func Example4()
Local
$n, $msg
GUICreate("獲取時(shí)間 GUI", 200, 200, 800, 200)
$n
= GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT)
GUISetState()
; 運(yùn)行 GUI, 直到
GUI 被關(guān)閉
Do
$msg = GUIGetMsg()
Until
$msg = $GUI_EVENT_CLOSE
MsgBox(0, "時(shí)間", GUICtrlRead($n))
GUIDelete()
EndFunc ;==>Example4
provider with jb51.net (unicode) |