Results 1 to 23 of 23

Thread: Time?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311

    Time?

    How do i add a clock, digital or analog, analog better to my app?

    It is not a directx app.

    thankyou
    Sam.

  2. #2
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180
    Add a timer to your form with interval set to 1000 and a label.
    then use this code for the timer:

    VB Code:
    1. Private Sub Timer1_Timer()
    2. Label1.Caption = Time
    3. End Sub

  3. #3
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180
    Ow, I misread your post. You prefer analog above digital
    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.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311
    Ok i have done what you said and the label just days True.

    I am doing the digital one.
    thanks.
    Sam.

  5. #5
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180
    Originally posted by Chrome
    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?
    Oh, and as I stated above, the code I posted, give you an digital clock.

  6. #6
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    I know how to do the analog one if you want.
    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311
    Ok here.

    Private Sub Time_Timer()

    lblTime.Caption = Time

    End Sub
    Sam.

  8. #8
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    Originally posted by Chrome
    Ok here.

    Private Sub Time_Timer()

    lblTime.Caption = Time

    End Sub
    What you mean?
    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311
    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
    Sam.

  10. #10
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    I thought you wanted Analog. I can give you the code for it.

    Analog:
    ._._.
    . \_.
    ._._.

    Digital:

    _ _
    |_|*| | |
    |_|*|_| |


    Which one did you want in the first place?

    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  11. #11
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    Oh nevermind I misread.
    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311
    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.
    Sam.

  13. #13
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    Put a picture box on your form, and a timer with interval of 1000
    Leave default names
    VB Code:
    1. Public Sub ShowAnalogTime(ByVal MyTime As Date, Pic As PictureBox)
    2.     Dim H As Single, M As Single, S As Single
    3.     Const HPI As Double = 1.5707963267949  ' (4 * Atn(1)) / 2
    4.     Const PI2 As Double = 6.28318530717959 ' (4 * Atn(1)) * 2
    5.    
    6.     H = (Hour(MyTime) Mod 12) / 12#
    7.     M = Minute(MyTime) / 60#
    8.     S = Second(MyTime) / 60#
    9.    
    10.     Pic.Scale (-1.1, -1.1)-(1.1, 1.1)
    11.     Pic.DrawWidth = 2
    12.     Pic.Cls
    13.    
    14.     Pic.Circle (0, 0), 1, RGB(128, 128, 128)
    15.    
    16.     Pic.Line (0, 0)-(0.5 * Cos(PI2 * H - HPI), 0.5 * Sin(PI2 * H - HPI)), RGB(0, 0, 128)
    17.     Pic.Line (0, 0)-(0.8 * Cos(PI2 * M - HPI), 0.8 * Sin(PI2 * M - HPI)), RGB(128, 128, 255)
    18.     Pic.Line (0, 0)-(Cos(PI2 * S - HPI), Sin(PI2 * S - HPI)), RGB(255, 255, 255)
    19. End Sub
    20.  
    21. Private Sub Timer1_Timer()
    22.     ShowAnalogTime Time, Picture1
    23. End Sub

  14. #14
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180

    Thumbs up Alright!

    Whow, that's pretty cool!

  15. #15
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    Damn dude, My analog code was simpler than that.
    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  16. #16

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311
    k thanks alot dude.
    Sam.

  17. #17
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    PS, the picture must be perfect square, otherwise it won't show the circle properly...

  18. #18
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803
    Originally posted by Q_Me
    Damn dude, My analog code was simpler than that.
    If your analog code is simpler than mine, then why don't you post it ?

  19. #19
    Banned Michael_Kamen's Avatar
    Join Date
    May 2001
    Location
    The Netherlands
    Posts
    1,180

    Don't fight boys......

  20. #20
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591

    Re: Time?

    Originally posted by Chrome
    How do i add a clock, digital or analog, analog better to my app?
    For a simple digital, you can use statusbar control with a panel set to time style.

  21. #21
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    the digital one returned True because your timer name is also Time.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  22. #22
    Hyperactive Member Q_Me's Avatar
    Join Date
    Dec 2001
    Posts
    327
    Originally posted by CVMichael
    If your analog code is simpler than mine, then why don't you post it ?
    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.
    53323737 15 743 313402 05 740313063. 17 15 4150 743 313402 05 140393403437 5203 743 30210.


  23. #23

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Devon, UK
    Posts
    311
    Na guys i'm all right now, and now i see bugger, oops. lol.

    Thanks all of you.
    Sam.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width