Thanks but I want the digital clock made by dots means some dots will make numbers for the clock not displaying it in label.
You can make some picture boxes and add each the image or the dots you want to show.
Use the functions Hour, Minute and Second to get each number.
Suppose you have the numbers in picture boxes named as the number and make some cases:
You can put something like this in your timer
- Select Case Hour(Time)
-
Case 1
-
picturebox1.Picture = one.Picture
-
Case 2
-
picturebox1.Picture = two.Picture
-
' (...and so on ...)
-
End Select
Hi
Can you give me a short example for analog clock
I'll very thankful to you.
May God bless you
Sure, just make 3 lines in VB (I don't know how to make them in VBA)
Let's say the center of the clock is at 200, 200.
Remember the formula for a circle is X^2 + Y^2 = r^2, and lets say that r (the length of the line) will be 50, and will be the minute hand
x1 will always be 200
y1 will always be 200 too
The angle will be 90 - 6 * Minute(Time)
And if this is negative let's just add 360 to it. Something like:
Dim angle As Single
angle = 90 - (6 * Minute(Time))
If angle < 0 Then angle = angle + 360
Now see then sin(angle) = Y/r and cos(angle) = X/r.
Remember that you have your center at 200,200 and you're done:
line1.X2 = 200 - r * Cos(angle)
line1.Y2 = 200 - r * Sin(angle)
Something like that should work, I didn't revise it since I have a lot of work here (sorry about that) but it's the main idea.
Good Luck