找回密码
 加入
搜索
查看: 2054|回复: 4

[GUI管理] GUICtrlCreateDate 样式的疑问【已解决】

[复制链接]
发表于 2011-10-17 11:48:55 | 显示全部楼层 |阅读模式
本帖最后由 haodd 于 2011-10-17 18:12 编辑
$Date2 = GUICtrlCreateDate(@YEAR&"/"&@MON&"/"&@MDAY, 226, 13, 106, 21,$DTS_SHOWNONE)
怎么获取 勾选 和 不勾选的 结果

我试了我知道的 GUICtrlRead 和 GUICtrlgetstat 都不行呀
发表于 2011-10-17 12:54:39 | 显示全部楼层
本帖最后由 happytc 于 2011-10-17 12:57 编辑

看微软的说明:DTS_SHOWNONE
DTS_SHOWNONE  It is possible to have no date currently selected in the control. With this style, the control displays a check box that is automatically selected whenever a date is picked or entered. If the check box is subsequently deselected, the application cannot retrieve the date from the control because, in essence, the control has no date. The state of the check box can be set with the DTM_SETSYSTEMTIME message or queried with the DTM_GETSYSTEMTIME message.

所以不能从控件上获得这个状态,只能用消息DTM_GETSYSTEMTIME来得到。另外从上面说明中,我们还可以设置这个Pseu-CheckBox默认设为不选中状态。

#include <GUIConstants.au3>
#include <DateTimeConstants.au3>
#Include <GuiDateTimePicker.au3>

TestDateCheckbox()

Func TestDateCheckbox()
        Local $hGui, $Date, $hDate, $tDate, $Button, $msg, $lParam
        $hGui = GUICreate("Date Test", 200, 200)
        $Date = GUICtrlCreateDate ("", 10, 10, 100, 20, BitOR($DTS_SHORTDATEFORMAT, $DTS_SHOWNONE))
        $hDate = GUICtrlGetHandle($date)
        $tDate = 0
        _GUICtrlDTP_SetSystemTimeEx($hDate, $tDate, True)
        $Button = GUICtrlCreateButton ("get", 10, 80, 60, 20)
        GUISetState()

        Do
                $msg = GUIGetMsg()
                If $msg == $Button Then 
                        $lParam = GUICtrlRecvMsg($date, $DTM_GETSYSTEMTIME, 0, 1)
                        If $lParam == 0 Then
                                MsgBox(0, 0, "Is Checked")
                        Else
                                MsgBox(0, 0,"Not Checked")
                        EndIf
                EndIf
        until $msg == $GUI_EVENT_CLOSE

        GUIDelete($hGui)
EndFunc
 楼主| 发表于 2011-10-17 18:12:35 | 显示全部楼层
回复 2# happytc


    这正是我要的 谢谢  结贴咯 谢谢
发表于 2012-4-25 10:56:49 | 显示全部楼层
留个记号。。谢谢分享
发表于 2017-7-21 23:57:29 | 显示全部楼层
這個不錯喔  留個腳印 macgyver
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-20 18:33 , Processed in 0.074757 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表