找回密码
 加入
搜索
查看: 4708|回复: 7

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

  [复制链接]
发表于 2012-8-31 17:22:08 | 显示全部楼层 |阅读模式
本帖最后由 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来写数据呗
 楼主| 发表于 2012-8-31 22:03:26 | 显示全部楼层
先设置$data=GUICtrlCreateDate("空", 10, 10, 185, 20)
然后再用GUICtrlSetData来写数据呗
邪恶海盗 发表于 2012-8-31 21:57



    设置$data=GUICtrlCreateDate("空", 10, 10, 185, 20)
会自动用当前时间
发表于 2012-8-31 22:33:59 | 显示全部楼层
回复 3# zhouhaijin


    不可能吧,把你的代码贴上来看看,肯定是其它的地方有问题...
发表于 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



    不懂E文的飘过...
发表于 2012-9-1 13:17:52 | 显示全部楼层
本帖最后由 netegg 于 2012-9-1 13:19 编辑

凑合了一个
[au3]#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
[/au3]
发表于 2012-9-1 15:25:23 | 显示全部楼层
代码直接收下,谢谢.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-18 17:54 , Processed in 0.075289 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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