📄 form1.vb
字号:
Imports VB = Microsoft.VisualBasic
Friend Class Form1
Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
Public Sub New()
MyBase.New()
'此调用是 Windows 窗体设计器所必需的。
InitializeComponent()
End Sub
'窗体重写处置,以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents Label2 As System.Windows.Forms.Label
Public WithEvents Lable1 As System.Windows.Forms.Label
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器来修改它。
'不要使用代码编辑器来修改它。
Public WithEvents Button3 As System.Windows.Forms.Button
Public WithEvents Button2 As System.Windows.Forms.Button
Public WithEvents TextBox2 As System.Windows.Forms.TextBox
Public WithEvents TextBox1 As System.Windows.Forms.TextBox
Public WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.Button3 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.Lable1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'Button3
'
Me.Button3.BackColor = System.Drawing.SystemColors.Control
Me.Button3.Cursor = System.Windows.Forms.Cursors.Default
Me.Button3.ForeColor = System.Drawing.SystemColors.ControlText
Me.Button3.Location = New System.Drawing.Point(208, 160)
Me.Button3.Name = "Button3"
Me.Button3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Button3.Size = New System.Drawing.Size(113, 25)
Me.Button3.TabIndex = 6
Me.Button3.Text = "退出"
'
'Button2
'
Me.Button2.BackColor = System.Drawing.SystemColors.Control
Me.Button2.Cursor = System.Windows.Forms.Cursors.Default
Me.Button2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Button2.Location = New System.Drawing.Point(208, 88)
Me.Button2.Name = "Button2"
Me.Button2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Button2.Size = New System.Drawing.Size(113, 25)
Me.Button2.TabIndex = 1
Me.Button2.Text = "取得系统路径"
'
'TextBox2
'
Me.TextBox2.AcceptsReturn = True
Me.TextBox2.AutoSize = False
Me.TextBox2.BackColor = System.Drawing.SystemColors.Window
Me.TextBox2.Cursor = System.Windows.Forms.Cursors.IBeam
Me.TextBox2.ForeColor = System.Drawing.SystemColors.WindowText
Me.TextBox2.Location = New System.Drawing.Point(8, 88)
Me.TextBox2.MaxLength = 0
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.TextBox2.Size = New System.Drawing.Size(193, 19)
Me.TextBox2.TabIndex = 5
Me.TextBox2.Text = ""
'
'TextBox1
'
Me.TextBox1.AcceptsReturn = True
Me.TextBox1.AutoSize = False
Me.TextBox1.BackColor = System.Drawing.SystemColors.Window
Me.TextBox1.Cursor = System.Windows.Forms.Cursors.IBeam
Me.TextBox1.ForeColor = System.Drawing.SystemColors.WindowText
Me.TextBox1.Location = New System.Drawing.Point(8, 24)
Me.TextBox1.MaxLength = 0
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.TextBox1.Size = New System.Drawing.Size(193, 19)
Me.TextBox1.TabIndex = 3
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.BackColor = System.Drawing.SystemColors.Control
Me.Button1.Cursor = System.Windows.Forms.Cursors.Default
Me.Button1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Button1.Location = New System.Drawing.Point(208, 24)
Me.Button1.Name = "Button1"
Me.Button1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Button1.Size = New System.Drawing.Size(120, 25)
Me.Button1.TabIndex = 0
Me.Button1.Text = "取得 Windows 路径"
'
'Label2
'
Me.Label2.BackColor = System.Drawing.SystemColors.Control
Me.Label2.Cursor = System.Windows.Forms.Cursors.Default
Me.Label2.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label2.Location = New System.Drawing.Point(8, 72)
Me.Label2.Name = "Label2"
Me.Label2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Label2.Size = New System.Drawing.Size(136, 17)
Me.Label2.TabIndex = 4
Me.Label2.Text = "Window系统路径:"
'
'Lable1
'
Me.Lable1.BackColor = System.Drawing.SystemColors.Control
Me.Lable1.Cursor = System.Windows.Forms.Cursors.Default
Me.Lable1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Lable1.Location = New System.Drawing.Point(8, 8)
Me.Lable1.Name = "Lable1"
Me.Lable1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Lable1.Size = New System.Drawing.Size(81, 17)
Me.Lable1.TabIndex = 2
Me.Lable1.Text = "Windows路径:"
'
'Form1
'
Me.AcceptButton = Me.Button1
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(363, 199)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Lable1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Location = New System.Drawing.Point(109, 139)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "Form1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Text = "系统目录演示"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button1.Click
Dim WinPath As Object
Dim b As String
Dim p As Short
b = Space(260)
p = GetWindowsDirectory(b, Len(b))
WinPath = VB.Left(b, p)
TextBox1.Text = WinPath
End Sub
Private Sub Button2_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button2.Click
Dim WinSysPath As Object
Dim b As String
Dim p As Short
b = Space(260)
p = GetSystemDirectory(b, Len(b))
WinSysPath = VB.Left(b, p)
TextBox2.Text = WinSysPath
End Sub
Private Sub Button3_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -