VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Useful for displaying the system date and time using animation when a user clicks on an icon.

by Brandon (46 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 14th March 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Useful for displaying the system date and time using animation when a user clicks on an icon.

API Declarations


Private Const Right = 5040

Rate Useful for displaying the system date and time using animation when a user clicks on an icon.



'a timer, a toolbar, and an image list on the form.
'You must get the toolbar and image list controls by
'going to the menu bar and go to Project, Components,
'then check Microsoft Windows Common Controls 6.0
'apply the settings, and then click ok, afterwards select the
'appropriate controls.
'About Icons:
'Using icons involves some explaining, so below i will explain how to use
'them.
'1. On your image List Control, in your properties box, click custom.
'2. Then Click on the Images tab, Click Insert Picture.
'3. From there you will choose the appropriate icon.
'4. To find it, go to the following destination folder:
'   c:\Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Misc
' from here, choose any one of the clock icons.
'5. Now Click on the Toolbar you put on your form, click custom in its
'properties.
'6. From there, on the general tab, go to the ImageList1 drop down box
and select ImageList1
'7. Next, click on the buttons tab, this is where you will do the following:
a.  under caption type Date and Time
b.  in Key textbox Type DateTime
c.  in Tool Tip Next type Todays Date and Time
d.  In the Image Text Box on the right side, type 1
'8. Click ok, you should see the clock icon appear on the toolbar.

'Now Lets get to the code!!!
'place the following code on the correct forms
'notice i used all default names here except for the timer control

Private Sub Form_Load()
    Label1.Visible = False
End Sub

Private Sub MoveTime_Timer()
    MoveTime.Interval = 1
    Label1.Left = Label1.Left + 15
    If Label1.Left >= Right Then
        Label1.Visible = False
        Label1.Left = 0
        Label1.Caption = vbNullString
    End If
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Key
        Case "DateTime"
            Call TimeDate_Display(DateDisplay, TimeDisplay)
            MoveTime_Timer
    End Select
End Sub
Public Function TimeDate_Display(DateDisplay As Variant, TimeDisplay As Variant)
DateDisplay = Date
TimeDisplay = Time
NullString = "      "
Label1.Visible = True
Label1.Caption = DateDisplay & NullString & TimeDisplay
End Function






Download this snippet    Add to My Saved Code

Useful for displaying the system date and time using animation when a user clicks on an icon. Comments

No comments have been posted about Useful for displaying the system date and time using animation when a user clicks on an icon.. Why not be the first to post a comment about Useful for displaying the system date and time using animation when a user clicks on an icon..

Post your comment

Subject:
Message:
0/1000 characters