📄 form1.frm
字号:
TabIndex = 23
Top = 2160
Width = 5055
End
Begin VB.TextBox txtMemoryUsage
Alignment = 1 'Right Justify
Height = 285
Left = 1680
Locked = -1 'True
TabIndex = 21
Top = 1320
Width = 2055
End
Begin VB.TextBox txtComputerName
Height = 285
Left = 1680
Locked = -1 'True
TabIndex = 19
Top = 840
Width = 2055
End
Begin VB.TextBox txtUserName
Height = 285
Left = 1680
Locked = -1 'True
TabIndex = 17
Top = 360
Width = 2055
End
Begin VB.Label Label13
Caption = "Operating System:"
Height = 255
Left = 240
TabIndex = 26
Top = 3120
Width = 1335
End
Begin VB.Label Label12
Caption = "Logical Drives:"
Height = 255
Left = 240
TabIndex = 24
Top = 2640
Width = 1215
End
Begin VB.Label Label11
Caption = "Expand Enivornment Variable"
Height = 255
Left = 240
TabIndex = 22
Top = 1920
Width = 2655
End
Begin VB.Label Label10
Caption = "Memory Usage: NT Only"
Height = 495
Left = 240
TabIndex = 20
Top = 1320
Width = 1215
End
Begin VB.Label Label9
Caption = "Computer Name:"
Height = 255
Left = 240
TabIndex = 18
Top = 840
Width = 1455
End
Begin VB.Label Label8
Caption = "User Name:"
Height = 255
Left = 240
TabIndex = 16
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame1
Caption = "Path"
Height = 3615
Left = 120
TabIndex = 0
Top = 120
Width = 3975
Begin VB.TextBox txtChangeExtension
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 14
Top = 3120
Width = 2175
End
Begin VB.TextBox txtExtension
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 12
Top = 2640
Width = 2175
End
Begin VB.TextBox txtFileNameNoExt
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 10
Top = 2160
Width = 2175
End
Begin VB.TextBox txtRootDirectory
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 8
Top = 1680
Width = 2175
End
Begin VB.TextBox txtDirectory
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 6
Top = 1200
Width = 2175
End
Begin VB.TextBox txtFileName
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 4
Top = 720
Width = 2175
End
Begin VB.TextBox txtFullPath
Height = 285
Left = 1560
Locked = -1 'True
TabIndex = 1
Text = "c:\dir1\subdir2\filename.txt"
Top = 240
Width = 2175
End
Begin VB.Label Label7
Caption = "Change Extension:"
Height = 255
Left = 120
TabIndex = 13
Top = 3120
Width = 1455
End
Begin VB.Label Label6
Caption = "Extension:"
Height = 255
Left = 120
TabIndex = 11
Top = 2640
Width = 1335
End
Begin VB.Label Label5
Caption = "FileName No Ext:"
Height = 255
Left = 120
TabIndex = 9
Top = 2160
Width = 1575
End
Begin VB.Label Label4
Caption = "Root Directory:"
Height = 255
Left = 120
TabIndex = 7
Top = 1680
Width = 1455
End
Begin VB.Label Label3
Caption = "Directory:"
Height = 255
Left = 120
TabIndex = 5
Top = 1200
Width = 1455
End
Begin VB.Label Label2
Caption = "FileName:"
Height = 255
Left = 120
TabIndex = 3
Top = 720
Width = 975
End
Begin VB.Label Label1
Caption = "Full Path:"
Height = 255
Left = 120
TabIndex = 2
Top = 240
Width = 1215
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub DemonstratePath()
Dim FileName As String
FileName = "FileName.txt"
txtFullPath.Text = Path.GetFullPath(FileName)
txtFileName.Text = Path.GetFileName(txtFullPath.Text)
txtDirectory.Text = Path.GetDirectoryName(txtFullPath.Text)
txtRootDirectory.Text = Path.GetPathRoot(txtFullPath.Text)
txtFileNameNoExt.Text = Path.GetFileNameWithoutExtension(txtFullPath.Text)
txtExtension.Text = Path.GetExtension(txtFullPath.Text)
txtChangeExtension.Text = Path.ChangeExtension(txtFullPath.Text, "bin")
End Sub
Private Sub DemonstrateEnvironment()
txtUserName.Text = Environment.UserName
txtComputerName.Text = Environment.MachineName
txtMemoryUsage.Text = cString.Format("{0:n0}", Environment.WorkingSet)
txtExpandVariable.Text = Environment.ExpandEnvironmentVariables("Path = %path%")
txtLogicalDrives.Text = Join(Environment.GetLogicalDrives)
txtOperatingSystem.Text = Environment.OSVersion.ToString
End Sub
Private Sub DemonstrateMathExt()
txtPI.Text = PI
txtRadToDeg.Text = cString.Format("{0} radians = {1} degrees", PI, CDeg(PI))
txtDegToRad.Text = cString.Format("{0} degrees = {1} radians", 90, CRad(90))
Dim Quotient As Long
Dim Remainder As Long
Quotient = DivRem(13, 5, Remainder)
txtDivRem.Text = cString.Format("13/5 has a quotient of {0} and a remainder of {1}.", Quotient, Remainder)
txtCeilings.Text = cString.Format("Ceiling of {0} = {1} and {2} = {3}", 123.9, Ceiling(123.9), 123.1, Ceiling(123.1))
txtFloors.Text = cString.Format("Floor of {0} = {1} and {2} = {3}", 123.9, Floor(123.9), 123.1, Floor(123.1))
End Sub
Private Sub DemonstrateTimeZone()
With TimeZone.CurrentTimeZone
txtIsDayLightSavings.Text = .IsDayLightSavingTime(Now)
txtDayLightName.Text = .DayLightName
txtStandardName.Text = .StandardName
txtTimeZoneOffset.Text = .GetDayLightChanges(Year(Now)).Delta.ToString
txtDayLightStart.Text = .GetDayLightChanges(Year(Now)).StartTime.ToString
txtDayLightEnd.Text = .GetDayLightChanges(Year(Now)).EndTime.ToString
End With
End Sub
Private Sub Form_Load()
DemonstratePath
DemonstrateEnvironment
DemonstrateMathExt
DemonstrateTimeZone
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -