📄 form1.vb
字号:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 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
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents Splitter1 As System.Windows.Forms.Splitter
Friend WithEvents trvClass As System.Windows.Forms.TreeView
Friend WithEvents rtbNote As System.Windows.Forms.RichTextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.trvClass = New System.Windows.Forms.TreeView()
Me.Splitter1 = New System.Windows.Forms.Splitter()
Me.rtbNote = New System.Windows.Forms.RichTextBox()
Me.SuspendLayout()
'
'trvClass
'
Me.trvClass.Dock = System.Windows.Forms.DockStyle.Left
Me.trvClass.ImageIndex = -1
Me.trvClass.Name = "trvClass"
Me.trvClass.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("星期一"), New System.Windows.Forms.TreeNode("星期二"), New System.Windows.Forms.TreeNode("星期三"), New System.Windows.Forms.TreeNode("星期四"), New System.Windows.Forms.TreeNode("星期五")})
Me.trvClass.SelectedImageIndex = -1
Me.trvClass.Size = New System.Drawing.Size(176, 350)
Me.trvClass.TabIndex = 0
'
'Splitter1
'
Me.Splitter1.Location = New System.Drawing.Point(176, 0)
Me.Splitter1.Name = "Splitter1"
Me.Splitter1.Size = New System.Drawing.Size(8, 350)
Me.Splitter1.TabIndex = 1
Me.Splitter1.TabStop = False
'
'rtbNote
'
Me.rtbNote.Dock = System.Windows.Forms.DockStyle.Fill
Me.rtbNote.Location = New System.Drawing.Point(184, 0)
Me.rtbNote.Name = "rtbNote"
Me.rtbNote.Size = New System.Drawing.Size(376, 350)
Me.rtbNote.TabIndex = 2
Me.rtbNote.Text = "RichTextBox1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(560, 350)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.rtbNote, Me.Splitter1, Me.trvClass})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private strClassNotes(20) As String
Private strDayNotes(5) As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim trnClass As TreeNode
For Each trnClass In trvClass.Nodes
trnClass.Nodes.Add("上午1、2节")
trnClass.Nodes.Add("上午3、4节")
trnClass.Nodes.Add("下午1、2节")
trnClass.Nodes.Add("下午3、4节")
Next
rtbNote.Text = ""
End Sub
Private Sub trvClass_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles trvClass.AfterSelect
Dim trnCurrentNode As TreeNode
Static iClassIndex As Integer = 0
Static iDayIndex As Integer = 0
If iClassIndex <> -1 Then strClassNotes(iClassIndex) = rtbNote.Text
If iDayIndex <> -1 Then strDayNotes(iDayIndex) = rtbNote.Text
trnCurrentNode = trvClass.SelectedNode
If trnCurrentNode.Parent Is Nothing Then
iClassIndex = -1
iDayIndex = trnCurrentNode.Index
rtbNote.Text = strDayNotes(iDayIndex)
Else
iDayIndex = -1
iClassIndex = trnCurrentNode.Parent.Index * 4 + trnCurrentNode.Index
rtbNote.Text = strClassNotes(iClassIndex)
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -