chengjinn 发表于 2009-8-27 17:30:46

GUI显示时间

本帖最后由 chengjinn 于 2009-8-29 18:09 编辑

while 1
tooltip(@HOUR&':'&@MIN&':'&@SEC,980,3,'time',0,4)
sleep(1000)
WEnd我想把这样的显示时间的样式放在GUI里面...
但是想不出来要怎么放到GUI里面,,
有没有人做过的...?

afan 发表于 2009-9-16 10:44:53

LZ修改下~~$Form1 = GUICreate("Form1", 633, 447, 192, 124)
$Label_time = GUICtrlCreateLabel("Label2", 185, 262, 110, 20)
GUISetState(@SW_SHOW)
While 1
        $msg = GUIGetMsg()
        $b = @HOUR & ':' & @MIN & ':' & @SEC
        If GUICtrlRead($Label_time) <> $b then GUICtrlSetData($Label_time, $b)
        Switch $Msg
                Case -3
                        Exit
        EndSwitch
WEnd

chengjinn 发表于 2009-8-29 17:55:45

没有人顶.自已顶.

chengjinn 发表于 2009-8-29 18:08:48

$Form1 = GUICreate("Form1", 633, 447, 192, 124)
$Label_time= GUICtrlCreateLabel("Label2", 185, 262, 110, 20)
GUISetState(@SW_SHOW)
While 1

$msg=guigetmsg()
GUICtrlSetData($Label_time,@HOUR&':'&@MIN&':'&@SEC)

Sleep(1000)

WEnd
没有人帮我还是自已帮自已

Leeben 发表于 2009-9-15 14:32:13

老兄,解决是解决了,但是,窗口怎么也无法关闭,只能强行结束进程!

alexandrer270 发表于 2009-9-16 10:14:21

曾经看过一段“多线程”的例子,原作者记不住了
$Form1 = GUICreate("多线程实例", 272, 139, -1, -1)
$Label1 = GUICtrlCreateLabel("00:00:00:00", 8, 8, 146, 17)
$Label2 = GUICtrlCreateLabel("0", 8, 56, 150, 17)
$Label3 = GUICtrlCreateLabel("", 8, 104, 148, 17)
$Button1 = GUICtrlCreateButton("关闭线程1", 168, 8, 89, 25, 0)
$Button2 = GUICtrlCreateButton("关闭线程2", 168, 48, 89, 25, 0)
$Button3 = GUICtrlCreateButton("关闭线程3", 168, 96, 89, 25, 0)
GUISetState(@SW_SHOW)
Global $t2, $t3 = 1
$Timer = DllCallbackRegister("Timer", "int", "hwnd;uint;uint;dword")
$TimerDLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 1000, "ptr", DllCallbackGetPtr($Timer))
$Timer2 = DllCallbackRegister("Timer", "int", "hwnd;uint;uint;dword")
$Timer2DLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 200, "ptr", DllCallbackGetPtr($Timer2))
$Timer3 = DllCallbackRegister("Timer", "int", "hwnd;uint;uint;dword")
$Timer3DLL = DllCall("user32.dll", "uint", "SetTimer", "hwnd", 0, "uint", 0, "int", 500, "ptr", DllCallbackGetPtr($Timer3))
While 1
      Switch GUIGetMsg()
                Case - 3
                        Exit
                Case $Button1
                        DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $TimerDLL)
                        DllCallbackFree($Timer)
                Case $Button2
                        DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $Timer2DLL)
                        DllCallbackFree($Timer2)
                Case $Button3
                        DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "uint", $Timer3DLL)
                        DllCallbackFree($Timer3)
      EndSwitch
WEnd
Func Timer($hWnd, $uiMsg, $idEvent, $dwTime)
      If $idEvent = $TimerDLL Then
                GUICtrlSetData($Label1, @HOUR & ":" & @MIN & ":" & @SEC & ":" & @MSEC)
      ElseIf $idEvent = $Timer2DLL Then
                $t2 += 1
                GUICtrlSetData($Label2, $t2)
      ElseIf $idEvent = $Timer3DLL Then
                $t3 *= 2
                GUICtrlSetData($Label3, $t3)
      EndIf
EndFunc

presidentbym 发表于 2009-9-20 07:42:56

俺也是来学习的,不能帮你解答就来帮你顶一下

zxh1220 发表于 2009-9-20 08:16:04

不明白楼主想做成什么样子的,是只显示时间呀还是在GUI中嵌入一个这样开关的时间显示框?

yyy910 发表于 2009-10-10 15:34:43

学习了!谢谢!

amxi 发表于 2011-11-23 13:46:43

hoho,解决时间显示问题

kkk123 发表于 2013-1-18 21:26:00

谢谢分享。

mindy_xie 发表于 2013-3-19 17:50:20

回复 6# afan

suifeng123 发表于 2013-4-3 22:50:20

这个挺好的谢谢楼主。。。。。。。

plutosherry 发表于 2013-4-26 15:16:17

GUICtrlSetData($Label_time, $b)

If GUICtrlRead($Label_time) <> $b then GUICtrlSetData($Label_time, $b)
区别很精妙,afan大神,在下受教了。谢谢!!!

pris 发表于 2014-6-26 16:00:45

拿下,收藏。
页: [1] 2
查看完整版本: GUI显示时间