📄 vbhtpclock.ctl
字号:
VERSION 5.00
Begin VB.UserControl Clock
ClientHeight = 435
ClientLeft = 0
ClientTop = 0
ClientWidth = 1260
ScaleHeight = 29
ScaleMode = 3 'Pixel
ScaleWidth = 84
ToolboxBitmap = "vbhtpClock.ctx":0000
Begin VB.Timer tmrTimer
Interval = 1000
Left = 0
Top = 0
End
End
Attribute VB_Name = "Clock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Description = "Visual Basic 6 How To Program Clock control"
' Fig. 17.15
' ActiveX clock control
Option Explicit
'''''''''''''''''''''''''''''''''''
' UserControl event procedures '
'''''''''''''''''''''''''''''''''''
Private Sub UserControl_Show()
BackColor = Ambient.BackColor
End Sub
Private Sub UserControl_AmbientChanged(PropertyName As String)
If PropertyName = "BackColor" Then
BackColor = Ambient.BackColor
End If
End Sub
Private Sub UserControl_Resize()
Font.Size = ScaleY(ScaleHeight, vbPixels, vbPoints)
Width = 3.95 * Height
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("ForeColor", ForeColor, vbBlack)
End Sub
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
UserControl.ForeColor = PropBag.ReadProperty("ForeColor", vbBlack)
End Sub
'''''''''''''''''''''''''''''''''''
' UserControl property methods '
'''''''''''''''''''''''''''''''''''
Public Property Get ForeColor() As OLE_COLOR
Attribute ForeColor.VB_Description = "Returns/sets the foreground color of the Clock object"
ForeColor = UserControl.ForeColor
End Property
Public Property Let ForeColor(ByVal c As OLE_COLOR)
UserControl.ForeColor = c
Call PropertyChanged("ForeColor")
End Property
'''''''''''''''''''''''''''''''''''
' Timer event procedure '
'''''''''''''''''''''''''''''''''''
Private Sub tmrTimer_Timer()
Call Cls
Print Abs(Hour(Now) - 12) & ":";
Print Format$(Minute(Now), "00") & ":";
Print Format$(Second(Now), "00")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -