📄 formbase.vb
字号:
Public Class FormBase
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
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 pnlTop As System.Windows.Forms.Panel
Friend WithEvents Splitter1 As System.Windows.Forms.Splitter
Friend WithEvents pnlLeft As System.Windows.Forms.Panel
Friend WithEvents Splitter2 As System.Windows.Forms.Splitter
Friend WithEvents pnlMain As System.Windows.Forms.Panel
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox
Friend WithEvents lblCaption As System.Windows.Forms.Label
Friend WithEvents ilTreeView As System.Windows.Forms.ImageList
Friend WithEvents ilButton As System.Windows.Forms.ImageList
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnOk As System.Windows.Forms.Button
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents btnExit As System.Windows.Forms.Button
Friend WithEvents tvStudent As System.Windows.Forms.TreeView
Friend WithEvents Splitter3 As System.Windows.Forms.Splitter
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(FormBase))
Me.pnlTop = New System.Windows.Forms.Panel
Me.lblCaption = New System.Windows.Forms.Label
Me.PictureBox2 = New System.Windows.Forms.PictureBox
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.Splitter1 = New System.Windows.Forms.Splitter
Me.pnlLeft = New System.Windows.Forms.Panel
Me.tvStudent = New System.Windows.Forms.TreeView
Me.ilTreeView = New System.Windows.Forms.ImageList(Me.components)
Me.Splitter2 = New System.Windows.Forms.Splitter
Me.pnlMain = New System.Windows.Forms.Panel
Me.Splitter3 = New System.Windows.Forms.Splitter
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.btnExit = New System.Windows.Forms.Button
Me.ilButton = New System.Windows.Forms.ImageList(Me.components)
Me.btnCancel = New System.Windows.Forms.Button
Me.btnOk = New System.Windows.Forms.Button
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.pnlTop.SuspendLayout()
Me.pnlLeft.SuspendLayout()
Me.pnlMain.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.SuspendLayout()
'
'pnlTop
'
Me.pnlTop.Controls.Add(Me.lblCaption)
Me.pnlTop.Controls.Add(Me.PictureBox2)
Me.pnlTop.Controls.Add(Me.PictureBox1)
Me.pnlTop.Dock = System.Windows.Forms.DockStyle.Top
Me.pnlTop.Location = New System.Drawing.Point(0, 0)
Me.pnlTop.Name = "pnlTop"
Me.pnlTop.Size = New System.Drawing.Size(648, 48)
Me.pnlTop.TabIndex = 0
'
'lblCaption
'
Me.lblCaption.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lblCaption.Font = New System.Drawing.Font("隶书", 26.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.lblCaption.ForeColor = System.Drawing.SystemColors.Desktop
Me.lblCaption.Location = New System.Drawing.Point(88, 8)
Me.lblCaption.Name = "lblCaption"
Me.lblCaption.Size = New System.Drawing.Size(472, 32)
Me.lblCaption.TabIndex = 2
Me.lblCaption.Text = "标题 Label1"
Me.lblCaption.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'PictureBox2
'
Me.PictureBox2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Image)
Me.PictureBox2.Location = New System.Drawing.Point(584, 8)
Me.PictureBox2.Name = "PictureBox2"
Me.PictureBox2.Size = New System.Drawing.Size(32, 32)
Me.PictureBox2.TabIndex = 1
Me.PictureBox2.TabStop = False
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(32, 8)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(32, 32)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'Splitter1
'
Me.Splitter1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Splitter1.Dock = System.Windows.Forms.DockStyle.Top
Me.Splitter1.Enabled = False
Me.Splitter1.Location = New System.Drawing.Point(0, 48)
Me.Splitter1.Name = "Splitter1"
Me.Splitter1.Size = New System.Drawing.Size(648, 3)
Me.Splitter1.TabIndex = 1
Me.Splitter1.TabStop = False
'
'pnlLeft
'
Me.pnlLeft.Controls.Add(Me.tvStudent)
Me.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left
Me.pnlLeft.Location = New System.Drawing.Point(0, 51)
Me.pnlLeft.Name = "pnlLeft"
Me.pnlLeft.Size = New System.Drawing.Size(200, 410)
Me.pnlLeft.TabIndex = 2
'
'tvStudent
'
Me.tvStudent.BackColor = System.Drawing.SystemColors.Control
Me.tvStudent.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.tvStudent.Dock = System.Windows.Forms.DockStyle.Fill
Me.tvStudent.ImageList = Me.ilTreeView
Me.tvStudent.Location = New System.Drawing.Point(0, 0)
Me.tvStudent.Name = "tvStudent"
Me.tvStudent.Nodes.AddRange(New System.Windows.Forms.TreeNode() {New System.Windows.Forms.TreeNode("学校")})
Me.tvStudent.Size = New System.Drawing.Size(200, 410)
Me.tvStudent.TabIndex = 0
'
'ilTreeView
'
Me.ilTreeView.ImageSize = New System.Drawing.Size(16, 16)
Me.ilTreeView.ImageStream = CType(resources.GetObject("ilTreeView.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ilTreeView.TransparentColor = System.Drawing.Color.Transparent
'
'Splitter2
'
Me.Splitter2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Splitter2.Location = New System.Drawing.Point(200, 51)
Me.Splitter2.Name = "Splitter2"
Me.Splitter2.Size = New System.Drawing.Size(3, 410)
Me.Splitter2.TabIndex = 3
Me.Splitter2.TabStop = False
'
'pnlMain
'
Me.pnlMain.Controls.Add(Me.Splitter3)
Me.pnlMain.Controls.Add(Me.GroupBox2)
Me.pnlMain.Controls.Add(Me.GroupBox1)
Me.pnlMain.Dock = System.Windows.Forms.DockStyle.Fill
Me.pnlMain.Location = New System.Drawing.Point(203, 51)
Me.pnlMain.Name = "pnlMain"
Me.pnlMain.Size = New System.Drawing.Size(445, 410)
Me.pnlMain.TabIndex = 4
'
'Splitter3
'
Me.Splitter3.Dock = System.Windows.Forms.DockStyle.Bottom
Me.Splitter3.Enabled = False
Me.Splitter3.Location = New System.Drawing.Point(0, 335)
Me.Splitter3.Name = "Splitter3"
Me.Splitter3.Size = New System.Drawing.Size(445, 3)
Me.Splitter3.TabIndex = 2
Me.Splitter3.TabStop = False
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.btnExit)
Me.GroupBox2.Controls.Add(Me.btnCancel)
Me.GroupBox2.Controls.Add(Me.btnOk)
Me.GroupBox2.Dock = System.Windows.Forms.DockStyle.Bottom
Me.GroupBox2.Location = New System.Drawing.Point(0, 338)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(445, 72)
Me.GroupBox2.TabIndex = 1
Me.GroupBox2.TabStop = False
'
'btnExit
'
Me.btnExit.Font = New System.Drawing.Font("隶书", 18.0!, System.Drawing.FontStyle.Bold)
Me.btnExit.ForeColor = System.Drawing.SystemColors.Desktop
Me.btnExit.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnExit.ImageIndex = 2
Me.btnExit.ImageList = Me.ilButton
Me.btnExit.Location = New System.Drawing.Point(296, 24)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(120, 32)
Me.btnExit.TabIndex = 2
Me.btnExit.Text = "退出"
Me.btnExit.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'ilButton
'
Me.ilButton.ImageSize = New System.Drawing.Size(32, 32)
Me.ilButton.ImageStream = CType(resources.GetObject("ilButton.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ilButton.TransparentColor = System.Drawing.Color.Transparent
'
'btnCancel
'
Me.btnCancel.Font = New System.Drawing.Font("隶书", 18.0!, System.Drawing.FontStyle.Bold)
Me.btnCancel.ForeColor = System.Drawing.SystemColors.Desktop
Me.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnCancel.ImageIndex = 1
Me.btnCancel.ImageList = Me.ilButton
Me.btnCancel.Location = New System.Drawing.Point(160, 24)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(120, 32)
Me.btnCancel.TabIndex = 1
Me.btnCancel.Text = "Cancel"
Me.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'btnOk
'
Me.btnOk.Font = New System.Drawing.Font("隶书", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.btnOk.ForeColor = System.Drawing.SystemColors.Desktop
Me.btnOk.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnOk.ImageIndex = 0
Me.btnOk.ImageList = Me.ilButton
Me.btnOk.Location = New System.Drawing.Point(24, 24)
Me.btnOk.Name = "btnOk"
Me.btnOk.Size = New System.Drawing.Size(120, 32)
Me.btnOk.TabIndex = 0
Me.btnOk.Text = "OK"
Me.btnOk.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'GroupBox1
'
Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(445, 410)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
'
'FormBase
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(648, 461)
Me.Controls.Add(Me.pnlMain)
Me.Controls.Add(Me.Splitter2)
Me.Controls.Add(Me.pnlLeft)
Me.Controls.Add(Me.Splitter1)
Me.Controls.Add(Me.pnlTop)
Me.Name = "FormBase"
Me.Text = "FormBase"
Me.pnlTop.ResumeLayout(False)
Me.pnlLeft.ResumeLayout(False)
Me.pnlMain.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
'覆盖此方法完成OK按钮单击事件处理
Protected Overridable Sub OK()
'
End Sub
'覆盖此方法完成Cancel按钮单击事件处理
Protected Overridable Sub Cancel()
'
End Sub
'覆盖此方法完成窗体关闭操作
Protected Overridable Sub FormClose()
'
End Sub
'覆盖此方法完成窗体初始化操作
Protected Overridable Sub Init()
'
End Sub
'覆盖此方法完成TreeView初始化
Protected Overridable Sub InitTreeView()
'
End Sub
'覆盖此方法完成TreeView节点选择事件处理
Protected Overridable Sub SelectNode()
'
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
FormClose()
Me.Close()
End Sub
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
OK()
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Cancel()
End Sub
Private Sub Form_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
InitTreeView()
Init()
End Sub
'TreeView选择节点事件
Private Sub tvEmployee_AfterSelecet(ByVal sender As Object, ByVal e As TreeViewEventArgs) Handles tvStudent.AfterSelect
SelectNode()
End Sub
'TreeView单击事件处理
Private Sub tvStudent_MouseDown(ByVal send As Object, ByVal e As MouseEventArgs) Handles tvStudent.MouseDown
Dim tnClicked As TreeNode
tnClicked = tvStudent.GetNodeAt(New Point(e.X, e.Y))
If Not tnClicked Is Nothing And Not tnClicked Is tvStudent.Nodes(0) Then
tvStudent.SelectedNode = tnClicked
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -