Private RADSsec As Single
Private RADSmin As Single
Private RADShour As Single
Private DOTconfig As Single
Private CenterClock As Single
Private RADClock As Single'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=tmrClock,tmrClock,-1,Interval
Public Property Get Interval() As Long
Interval = tmrClock.Interval
End PropertyPublic Property Let Interval(ByVal New_Interval As Long)
tmrClock.Interval() = New_Interval
PropertyChanged "Interval"
End Property'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag) tmrClock.Interval = PropBag.ReadProperty("Interval", 0)
End Sub'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("Interval", tmrClock.Interval, 0)
End Sub
Private Sub tmrClock_Timer()
'find the number of radians for the angle of lines
RADSsec = ((Second(time) * 6 - 90) * 3.14159) / 180
RADSmin = (((Minute(time) * 6 - 90) * 3.14159) / 180) + ((Second(time) * 6 - 90) * 3.14159) / 10800
If Hour(time) < 12 Then 'make sure hours are 12 or less
RADShour = (((Hour(time) * 30 - 90) * 3.14159) / 180) + (((Minute(time) * 5) * 3.14159) / 1800)
Else
RADShour = ((((Hour(time) - 12) * 30 - 90) * 3.14159) / 180) + (((Minute(time) * 5) * 3.14159) / 1800)
End If
Call ShowsClock
End Sub
Private Sub ShowsClock()
'find where the second point of lines should be based on angles
linSec.X2 = Cos(RADSsec) * (RADClock - 50) + linSec.X1
linSec.Y2 = Sin(RADSsec) * (RADClock - 50) + linSec.Y1
linMin.X2 = Cos(RADSmin) * (RADClock - 100) + linMin.X1
linMin.Y2 = Sin(RADSmin) * (RADClock - 100) + linMin.Y1
linHour.X2 = Cos(RADShour) * (RADClock - 200) + linHour.X1
linHour.Y2 = Sin(RADShour) * (RADClock - 200) + linHour.Y1
End SubPrivate Sub UserControl_Resize()
UserControl.Cls
Dim i As Integer
If UserControl.Width < 600 Or UserControl.Height < 600 Then UserControl.Width = 600
UserControl.Height = UserControl.Width
'put all lines to the center
CenterClock = UserControl.Width / 2
RADClock = UserControl.Width / 2 - 100
linSec.X1 = CenterClock
linSec.Y1 = CenterClock
linMin.X1 = CenterClock
linMin.Y1 = CenterClock
linHour.X1 = CenterClock
linHour.Y1 = CenterClock
For i = 1 To 12 'draw in circles to hours
DOTconfig = (((i * 30 - 90) * 3.14159) / 180)
If i Mod 3 = 0 Then
UserControl.Line (Cos(DOTconfig) * (RADClock - 30) + CenterClock, Sin(DOTconfig) * (RADClock - 30) + CenterClock)-(Cos(DOTconfig) * (RADClock - 100) + CenterClock, Sin(DOTconfig) * (RADClock - 100) + CenterClock)
Else
UserControl.Line (Cos(DOTconfig) * (RADClock - 50) + CenterClock, Sin(DOTconfig) * (RADClock - 50) + CenterClock)-(Cos(DOTconfig) * (RADClock - 100) + CenterClock, Sin(DOTconfig) * (RADClock - 100) + CenterClock)
End If
Next i
Call ShowsClock
End Sub
Private RADSmin As Single
Private RADShour As Single
Private DOTconfig As Single
Private CenterClock As Single
Private RADClock As Single'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=tmrClock,tmrClock,-1,Interval
Public Property Get Interval() As Long
Interval = tmrClock.Interval
End PropertyPublic Property Let Interval(ByVal New_Interval As Long)
tmrClock.Interval() = New_Interval
PropertyChanged "Interval"
End Property'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag) tmrClock.Interval = PropBag.ReadProperty("Interval", 0)
End Sub'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag) Call PropBag.WriteProperty("Interval", tmrClock.Interval, 0)
End Sub
Private Sub tmrClock_Timer()
'find the number of radians for the angle of lines
RADSsec = ((Second(time) * 6 - 90) * 3.14159) / 180
RADSmin = (((Minute(time) * 6 - 90) * 3.14159) / 180) + ((Second(time) * 6 - 90) * 3.14159) / 10800
If Hour(time) < 12 Then 'make sure hours are 12 or less
RADShour = (((Hour(time) * 30 - 90) * 3.14159) / 180) + (((Minute(time) * 5) * 3.14159) / 1800)
Else
RADShour = ((((Hour(time) - 12) * 30 - 90) * 3.14159) / 180) + (((Minute(time) * 5) * 3.14159) / 1800)
End If
Call ShowsClock
End Sub
Private Sub ShowsClock()
'find where the second point of lines should be based on angles
linSec.X2 = Cos(RADSsec) * (RADClock - 50) + linSec.X1
linSec.Y2 = Sin(RADSsec) * (RADClock - 50) + linSec.Y1
linMin.X2 = Cos(RADSmin) * (RADClock - 100) + linMin.X1
linMin.Y2 = Sin(RADSmin) * (RADClock - 100) + linMin.Y1
linHour.X2 = Cos(RADShour) * (RADClock - 200) + linHour.X1
linHour.Y2 = Sin(RADShour) * (RADClock - 200) + linHour.Y1
End SubPrivate Sub UserControl_Resize()
UserControl.Cls
Dim i As Integer
If UserControl.Width < 600 Or UserControl.Height < 600 Then UserControl.Width = 600
UserControl.Height = UserControl.Width
'put all lines to the center
CenterClock = UserControl.Width / 2
RADClock = UserControl.Width / 2 - 100
linSec.X1 = CenterClock
linSec.Y1 = CenterClock
linMin.X1 = CenterClock
linMin.Y1 = CenterClock
linHour.X1 = CenterClock
linHour.Y1 = CenterClock
For i = 1 To 12 'draw in circles to hours
DOTconfig = (((i * 30 - 90) * 3.14159) / 180)
If i Mod 3 = 0 Then
UserControl.Line (Cos(DOTconfig) * (RADClock - 30) + CenterClock, Sin(DOTconfig) * (RADClock - 30) + CenterClock)-(Cos(DOTconfig) * (RADClock - 100) + CenterClock, Sin(DOTconfig) * (RADClock - 100) + CenterClock)
Else
UserControl.Line (Cos(DOTconfig) * (RADClock - 50) + CenterClock, Sin(DOTconfig) * (RADClock - 50) + CenterClock)-(Cos(DOTconfig) * (RADClock - 100) + CenterClock, Sin(DOTconfig) * (RADClock - 100) + CenterClock)
End If
Next i
Call ShowsClock
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货