How do i add a clock, digital or analog, analog better to my app?
It is not a directx app.
thankyou
Printable View
How do i add a clock, digital or analog, analog better to my app?
It is not a directx app.
thankyou
Add a timer to your form with interval set to 1000 and a label.
then use this code for the timer:
VB Code:
Private Sub Timer1_Timer() Label1.Caption = Time End Sub
Ow, I misread your post. You prefer analog above digital :D
Well, then you must draw a line and use a timer to change one of its coordinates all the time to make it turn in a circle.
Ok i have done what you said and the label just days True.
I am doing the digital one.
thanks.
The label says true??? Could you post your code?Quote:
Originally posted by Chrome
Ok i have done what you said and the label just days True.
I am doing the digital one.
thanks.
Oh, and as I stated above, the code I posted, give you an digital clock.
I know how to do the analog one if you want. :D
Ok here.
Private Sub Time_Timer()
lblTime.Caption = Time
End Sub
What you mean? :confused:Quote:
Originally posted by Chrome
Ok here.
Private Sub Time_Timer()
lblTime.Caption = Time
End Sub
i dunno i jus wrote wat mike said 2 put.
Private Sub Time_Timer() <--------- is my timer
lblTime.Caption = Time <--------- is where i want time to display
End Sub
I thought you wanted Analog. I can give you the code for it.
Analog:
._._.
. \_.
._._.
Digital:
_ _
|_|*| | |
|_|*|_| |
Which one did you want in the first place?
:confused:
Oh nevermind I misread.
ok, no i wanted analog, but thought digi was easier, but if u can help me wiv analog then it much much MUCH appreciated.
thanks.
Put a picture box on your form, and a timer with interval of 1000
Leave default names
VB Code:
Public Sub ShowAnalogTime(ByVal MyTime As Date, Pic As PictureBox) Dim H As Single, M As Single, S As Single Const HPI As Double = 1.5707963267949 ' (4 * Atn(1)) / 2 Const PI2 As Double = 6.28318530717959 ' (4 * Atn(1)) * 2 H = (Hour(MyTime) Mod 12) / 12# M = Minute(MyTime) / 60# S = Second(MyTime) / 60# Pic.Scale (-1.1, -1.1)-(1.1, 1.1) Pic.DrawWidth = 2 Pic.Cls Pic.Circle (0, 0), 1, RGB(128, 128, 128) Pic.Line (0, 0)-(0.5 * Cos(PI2 * H - HPI), 0.5 * Sin(PI2 * H - HPI)), RGB(0, 0, 128) Pic.Line (0, 0)-(0.8 * Cos(PI2 * M - HPI), 0.8 * Sin(PI2 * M - HPI)), RGB(128, 128, 255) Pic.Line (0, 0)-(Cos(PI2 * S - HPI), Sin(PI2 * S - HPI)), RGB(255, 255, 255) End Sub Private Sub Timer1_Timer() ShowAnalogTime Time, Picture1 End Sub
Whow, that's pretty cool!
:eek::eek: Damn dude, My analog code was simpler than that.
k thanks alot dude.
PS, the picture must be perfect square, otherwise it won't show the circle properly...
If your analog code is simpler than mine, then why don't you post it ?Quote:
Originally posted by Q_Me
:eek::eek: Damn dude, My analog code was simpler than that.
:D
Don't fight boys......
For a simple digital, you can use statusbar control with a panel set to time style. :)Quote:
Originally posted by Chrome
How do i add a clock, digital or analog, analog better to my app?
the digital one returned True because your timer name is also Time.
I think he's better off with yours, mine needs like a page in a module for all the information. But with mine, you can customly make it. But I dont think he want's a fancy one.Quote:
Originally posted by CVMichael
If your analog code is simpler than mine, then why don't you post it ?
Na guys i'm all right now, and now i see bugger, oops. lol.
Thanks all of you.