📄 format.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4620
ClientLeft = 3435
ClientTop = 2025
ClientWidth = 5430
LinkTopic = "Form1"
ScaleHeight = 4620
ScaleWidth = 5430
Begin VB.Frame Frame2
Caption = "时间格式化"
Height = 4335
Index = 0
Left = 3000
TabIndex = 1
Top = 120
Width = 2295
Begin VB.OptionButton Option1
Caption = "d-mmmm h:mm:ss"
Height = 195
Index = 6
Left = 120
TabIndex = 24
Top = 3960
Width = 2055
End
Begin VB.OptionButton Option1
Caption = "hh:mm am/pm"
Height = 195
Index = 5
Left = 120
TabIndex = 23
Top = 3720
Width = 2055
End
Begin VB.OptionButton Option1
Caption = "h:mm:ss a/p"
Height = 195
Index = 4
Left = 120
TabIndex = 22
Top = 3480
Width = 2055
End
Begin VB.OptionButton Option1
Caption = "dddd,mmmm dd,yyyy"
Height = 195
Index = 3
Left = 120
TabIndex = 21
Top = 3240
Width = 2055
End
Begin VB.OptionButton Option1
Caption = "mmmm-yy"
Height = 195
Index = 2
Left = 120
TabIndex = 20
Top = 3000
Width = 2055
End
Begin VB.OptionButton Option1
Caption = "(m/d/yy)"
Height = 195
Index = 1
Left = 120
TabIndex = 19
Top = 2760
Width = 2055
End
Begin VB.OptionButton Option1
Caption = "d-mmmm"
Height = 195
Index = 0
Left = 120
TabIndex = 18
Top = 2520
Width = 2055
End
Begin VB.TextBox Text2
Height = 375
Left = 120
TabIndex = 17
Top = 1440
Width = 2055
End
Begin VB.Label Label6
Caption = "请选择格式:"
Height = 255
Left = 120
TabIndex = 25
Top = 2160
Width = 2055
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "输出结果"
Height = 495
Left = 120
TabIndex = 5
Top = 840
Width = 2055
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "现在时间"
Height = 495
Left = 120
TabIndex = 3
Top = 360
Width = 2055
End
End
Begin VB.Frame Frame1
Caption = "数字格式化"
Height = 4335
Left = 120
TabIndex = 0
Top = 120
Width = 2775
Begin VB.CommandButton Command2
Caption = "输出结果"
Height = 375
Left = 240
TabIndex = 16
Top = 3840
Width = 2175
End
Begin VB.TextBox Text1
Height = 375
Left = 240
TabIndex = 15
Top = 1440
Width = 2415
End
Begin VB.CommandButton Command1
Caption = "-"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 7
Left = 2040
TabIndex = 14
Top = 3120
Width = 375
End
Begin VB.CommandButton Command1
Caption = "+"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 6
Left = 1440
TabIndex = 13
Top = 3120
Width = 375
End
Begin VB.CommandButton Command1
Caption = "."
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 5
Left = 840
TabIndex = 12
Top = 3120
Width = 375
End
Begin VB.CommandButton Command1
Caption = ":"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 4
Left = 240
TabIndex = 11
Top = 3120
Width = 375
End
Begin VB.CommandButton Command1
Caption = "$"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 3
Left = 2040
TabIndex = 10
Top = 2640
Width = 375
End
Begin VB.CommandButton Command1
Caption = ","
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 1440
TabIndex = 9
Top = 2640
Width = 375
End
Begin VB.CommandButton Command1
Caption = "#"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 840
TabIndex = 8
Top = 2640
Width = 375
End
Begin VB.CommandButton Command1
Caption = "0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 240
TabIndex = 7
Top = 2640
Width = 375
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "请选择格式化的符号:"
Height = 495
Left = 240
TabIndex = 6
Top = 2040
Width = 2415
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "格式化表达式:"
Height = 495
Left = 240
TabIndex = 4
Top = 1080
Width = 2415
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "等待格式化的数字:1234567890.0987654321"
Height = 495
Left = 240
TabIndex = 2
Top = 360
Width = 2175
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim FormatExp As String
Dim ThisTime As Date
Private Sub Command1_Click(Index As Integer)
FormatExp = FormatExp + Command1(Index).Caption
Text1.Text = FormatExp
End Sub
Private Sub Command2_Click()
a$ = Format("1234567890.0987654321", FormatExp)
Label1.Caption = "格式化后的数值:" + a$
Text1.Text = ""
FormatExp = ""
End Sub
Private Sub Form_Load()
ThisTime = Now
Label2.Caption = ThisTime
End Sub
Private Sub Option1_Click(Index As Integer)
Text2.Text = Format(ThisTime, Option1(Index).Caption)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -