zhouhaijin 发表于 2012-8-31 17:22:08

[已解决]GUICtrlCreateDate 时间控件 的默认值怎么设置为空

本帖最后由 zhouhaijin 于 2014-8-18 22:21 编辑

GUICtrlCreateDate 时间控件 的默认值怎么设置为空

添加一个用户,出生日期初始值是空,因为有时候添加用户没用选择出生日期,点过去出现选择的时候最好能从1980/01/01开始#include <GUIConstantsEx.au3>


GUICreate("My GUI get date", 200, 100, -1, -1)
$date = GUICtrlCreateDate("1980/01/01", 10, 10, 185, 20)


GUISetState()
Do
        $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

邪恶海盗 发表于 2012-8-31 21:57:51

先设置$data=GUICtrlCreateDate("空", 10, 10, 185, 20)
然后再用GUICtrlSetData来写数据呗

zhouhaijin 发表于 2012-8-31 22:03:26

先设置$data=GUICtrlCreateDate("空", 10, 10, 185, 20)
然后再用GUICtrlSetData来写数据呗
邪恶海盗 发表于 2012-8-31 21:57 http://www.autoitx.com/images/common/back.gif


    设置$data=GUICtrlCreateDate("空", 10, 10, 185, 20)
会自动用当前时间

邪恶海盗 发表于 2012-8-31 22:33:59

回复 3# zhouhaijin


    不可能吧,把你的代码贴上来看看,肯定是其它的地方有问题...

happytc 发表于 2012-8-31 23:13:38

回复 1# zhouhaijin


It's a big trouble.
Maybe you can create two Control: one textbox,the other Datetime picker

then put the textbox over datetime picker when you press new button to hide textbox and show datetime picker

This is work arround for fast, easy and dirty solution, uh!

邪恶海盗 发表于 2012-9-1 10:37:40

回复zhouhaijin


It's a big trouble.
Maybe you can create two Control: one textbox,the othe ...
happytc 发表于 2012-8-31 23:13 http://www.autoitx.com/images/common/back.gif


    不懂E文的飘过...

netegg 发表于 2012-9-1 13:17:52

本帖最后由 netegg 于 2012-9-1 13:19 编辑

凑合了一个
#include <GUIConstantsEx.au3>
#include <GuiDateTimePicker.au3>
#include <winapi.au3>
#include <GUIEdit.au3>
#include <GuiListView.au3>
#include <Editconstants.au3>
#include <WindowsConstants.au3>

Local $iStyle = BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT)
$hWnd = GUICreate("My GUI get date", 200, 100, -1, -1)
$date = GUICtrlCreateDate("1980/01/01", 10, 10, 185, 20, $DTS_UPDOWN)


$hEdit = _GUICtrlEdit_Create($hWnd, '', 10, 10, 165, 22, $iStyle)
_GUICtrlEdit_SetSel($hEdit, 0, -1)
$hDC = _WinAPI_GetWindowDC($hEdit)
$hBrush = _WinAPI_CreateSolidBrush(0x0000FF)

Local $stRect = DllStructCreate('int;int;int;int')
DllStructSetData($stRect, 1, 0)
DllStructSetData($stRect, 2, 0)
DllStructSetData($stRect, 3, 160)
DllStructSetData($stRect, 4, 20)
_WinAPI_FrameRect($hDC, DllStructGetPtr($stRect), $hBrush)
GUISetState()


Do
        $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

lxzan 发表于 2012-9-1 15:25:23

代码直接收下,谢谢.
页: [1]
查看完整版本: [已解决]GUICtrlCreateDate 时间控件 的默认值怎么设置为空