📄 frmtest.frm
字号:
VERSION 5.00
Object = "{11998CBD-30CA-11D5-AFAD-0000B43618D7}#32.0#0"; "DigitBox.ocx"
Begin VB.Form Form1
BorderStyle = 5 'Sizable ToolWindow
Caption = "DigitBox Sample"
ClientHeight = 3930
ClientLeft = 60
ClientTop = 300
ClientWidth = 4770
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3930
ScaleWidth = 4770
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin WSDigitbox.DigitBox DigitBox1
Height = 345
Left = 240
TabIndex = 24
Top = 120
Width = 810
_ExtentX = 1429
_ExtentY = 609
DigitDisplay = "543"
End
Begin VB.CheckBox chkError
Caption = "Show Error"
Height = 195
Left = 240
TabIndex = 22
Top = 3360
Width = 1215
End
Begin VB.Frame Frame
Caption = "Justify"
Height = 1095
Index = 4
Left = 1440
TabIndex = 17
Top = 2040
Width = 975
Begin VB.OptionButton optJustify
Caption = "Right"
Height = 255
Index = 1
Left = 120
TabIndex = 19
Top = 720
Value = -1 'True
Width = 735
End
Begin VB.OptionButton optJustify
Caption = "Left"
Height = 255
Index = 0
Left = 120
TabIndex = 18
Top = 360
Width = 735
End
End
Begin VB.Frame Frame
Caption = "Format"
Height = 1335
Index = 3
Left = 2760
TabIndex = 13
Top = 1920
Width = 1815
Begin VB.OptionButton optFormat
Caption = "Decimal"
Height = 255
Index = 3
Left = 240
TabIndex = 23
Top = 960
Width = 1095
End
Begin VB.OptionButton optFormat
Caption = "Long Time"
Height = 255
Index = 2
Left = 240
TabIndex = 16
Top = 720
Width = 1095
End
Begin VB.OptionButton optFormat
Caption = "Short Time"
Height = 255
Index = 1
Left = 240
TabIndex = 15
Top = 480
Width = 1335
End
Begin VB.OptionButton optFormat
Caption = "General"
Height = 255
Index = 0
Left = 240
TabIndex = 14
Top = 240
Value = -1 'True
Width = 1095
End
End
Begin VB.TextBox txtValue
Height = 285
Left = 2760
TabIndex = 12
Text = "543"
Top = 960
Width = 1815
End
Begin VB.Frame Frame
Caption = "OutLine"
Height = 975
Index = 2
Left = 1440
TabIndex = 9
Top = 840
Width = 975
Begin VB.OptionButton optOutLine
Caption = "True"
Height = 255
Index = 1
Left = 120
TabIndex = 11
Top = 600
Value = -1 'True
Width = 735
End
Begin VB.OptionButton optOutLine
Caption = "False"
Height = 255
Index = 0
Left = 120
TabIndex = 10
Top = 240
Width = 735
End
End
Begin VB.HScrollBar hscShowNum
Height = 255
Left = 2760
Max = 25
Min = 1
TabIndex = 7
Top = 1560
Value = 4
Width = 1815
End
Begin VB.Frame Frame
Caption = "Size"
Height = 975
Index = 1
Left = 240
TabIndex = 4
Top = 840
Width = 975
Begin VB.OptionButton optSize
Caption = "Large"
Height = 255
Index = 1
Left = 120
TabIndex = 6
Top = 600
Width = 735
End
Begin VB.OptionButton optSize
Caption = "Small"
Height = 255
Index = 0
Left = 120
TabIndex = 5
Top = 240
Value = -1 'True
Width = 735
End
End
Begin VB.Frame Frame
Caption = "Color"
Height = 1095
Index = 0
Left = 240
TabIndex = 0
Top = 2040
Width = 975
Begin VB.OptionButton optColor
Caption = "Red"
Height = 255
Index = 2
Left = 120
TabIndex = 3
Top = 720
Value = -1 'True
Width = 735
End
Begin VB.OptionButton optColor
Caption = "Green"
Height = 255
Index = 1
Left = 120
TabIndex = 2
Top = 480
Width = 735
End
Begin VB.OptionButton optColor
Caption = "Blue"
Height = 255
Index = 0
Left = 120
TabIndex = 1
Top = 240
Width = 735
End
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 2400
Top = 1680
End
Begin VB.Label Label1
Caption = "Justify and Placeholder are ignored for the Time Formats."
Height = 495
Index = 2
Left = 1680
TabIndex = 21
Top = 3360
Width = 2655
End
Begin VB.Label Label1
Caption = "Display + or - numbers"
Height = 255
Index = 1
Left = 2760
TabIndex = 20
Top = 720
Width = 1815
End
Begin VB.Label Label1
Caption = "Place Holders"
Height = 255
Index = 0
Left = 2760
TabIndex = 8
Top = 1320
Width = 1575
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim dStartNime As Date
Private Sub chkError_Click()
'True or False
'Displays Err when True
DigitBox1.DigitError = CBool(chkError.Value)
End Sub
Private Sub Form_Load()
'Used for the Short Time Format display
dStartNime = Now
End Sub
Private Sub hscShowNum_Change()
' Determines the number of digit placeholders
'Ignored for Time Formats
DigitBox1.DigitPlaceHolders = hscShowNum.Value
End Sub
Private Sub optColor_Click(Index As Integer)
'Three colors to chose from
'dgBlue = 0
'dgGreen = 1
'dgRed = 2
DigitBox1.DigitColor = Index
End Sub
Private Sub optFormat_Click(Index As Integer)
DigitBox1.DigitFormat = Index
Select Case Index
Case 1, 2 'dgShortTime and dgLongTime
'Let the Timer Control set the DigitDisplay property
Timer1.Enabled = True
Case Else
Timer1.Enabled = False
'Set the display
DigitBox1.DigitDisplay = txtValue.Text
End Select
'dgGeneral = 0
'dgShortTime = 1
'dgLongTime = 2
'dgDecimal = 3
End Sub
Private Sub optJustify_Click(Index As Integer)
'Justify left or right
'dgLeft = 0
'dgRight = 1
'Ignored with Time Format
DigitBox1.DigitJustify = Index
End Sub
Private Sub optOutLine_Click(Index As Integer)
'Outline with system colors
' True or False
DigitBox1.DigitOutLine = CBool(Index)
End Sub
Private Sub optSize_Click(Index As Integer)
'Set the digit size
'dgSmall = 0
'dgLarge = 1
DigitBox1.DigitSize = Index
End Sub
Private Sub Timer1_Timer()
Dim sTemp As String
'Time format will except
'#:## or ##:## for short time
'#:##:## or ##:##:## for long time
'Any other format will generate a blank clock face
If DigitBox1.DigitFormat = dgShortTime Then
sTemp = Format$(dStartNime - Now, "n:ss")
'Could also be hh:nn for hours and minutes
'sTemp = Format$( Now, "h:nn")
ElseIf DigitBox1.DigitFormat = dgLongTime Then
'Form 24 hour format use
'sTemp = Format$(Now, "hh:nn:ss")
'For 12 hour format
sTemp = Format$(Now, "h:nn:ssAM/PM")
'This will get rid of the AM or PM
If Len(sTemp) = 10 Then
sTemp = Left$(sTemp, 8)
ElseIf Len(sTemp) = 9 Then
sTemp = Left$(sTemp, 7)
End If
End If
DigitBox1.DigitDisplay = sTemp
End Sub
Private Sub txtValue_Change()
'Set the display
'In this example it is used for Decimal and General
'Time format is set from the timer.
' ' .0' is added for Decimal format if no decimal is present
'Excepted: - . 0 through 9
DigitBox1.DigitDisplay = txtValue.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -