📄 main.vb
字号:
Imports System.Threading.Thread
Public Class main_form
Inherits System.Windows.Forms.Form
Dim th As Threading.Thread
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents MenuItem11 As System.Windows.Forms.MenuItem
Friend WithEvents time As System.Windows.Forms.StatusBarPanel
Friend WithEvents dat As System.Windows.Forms.StatusBarPanel
Friend WithEvents st1 As System.Windows.Forms.StatusBar
Friend WithEvents mnu_close As System.Windows.Forms.MenuItem
Friend WithEvents mnu_exit As System.Windows.Forms.MenuItem
Friend WithEvents mnu_trans As System.Windows.Forms.MenuItem
Friend WithEvents mnu_studinfo As System.Windows.Forms.MenuItem
Friend WithEvents mnu_bookinfo As System.Windows.Forms.MenuItem
Friend WithEvents mnu_options As System.Windows.Forms.MenuItem
Friend WithEvents mnu_chngpass As System.Windows.Forms.MenuItem
Friend WithEvents mnu_index As System.Windows.Forms.MenuItem
Friend WithEvents mnu_about As System.Windows.Forms.MenuItem
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents menu1 As System.Windows.Forms.MenuItem
Friend WithEvents menu2 As System.Windows.Forms.MenuItem
Friend WithEvents menu3 As System.Windows.Forms.MenuItem
Friend WithEvents menu4 As System.Windows.Forms.MenuItem
Friend WithEvents menu5 As System.Windows.Forms.MenuItem
Public WithEvents MainMenu As System.Windows.Forms.MainMenu
Friend WithEvents pname As System.Windows.Forms.StatusBarPanel
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(main_form))
Me.st1 = New System.Windows.Forms.StatusBar
Me.time = New System.Windows.Forms.StatusBarPanel
Me.pname = New System.Windows.Forms.StatusBarPanel
Me.dat = New System.Windows.Forms.StatusBarPanel
Me.MainMenu = New System.Windows.Forms.MainMenu
Me.menu1 = New System.Windows.Forms.MenuItem
Me.mnu_close = New System.Windows.Forms.MenuItem
Me.mnu_exit = New System.Windows.Forms.MenuItem
Me.menu2 = New System.Windows.Forms.MenuItem
Me.mnu_trans = New System.Windows.Forms.MenuItem
Me.mnu_studinfo = New System.Windows.Forms.MenuItem
Me.mnu_bookinfo = New System.Windows.Forms.MenuItem
Me.menu3 = New System.Windows.Forms.MenuItem
Me.mnu_options = New System.Windows.Forms.MenuItem
Me.mnu_chngpass = New System.Windows.Forms.MenuItem
Me.menu4 = New System.Windows.Forms.MenuItem
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.menu5 = New System.Windows.Forms.MenuItem
Me.mnu_index = New System.Windows.Forms.MenuItem
Me.MenuItem11 = New System.Windows.Forms.MenuItem
Me.mnu_about = New System.Windows.Forms.MenuItem
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
CType(Me.time, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.pname, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.dat, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'st1
'
Me.st1.Location = New System.Drawing.Point(0, 327)
Me.st1.Name = "st1"
Me.st1.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.time, Me.pname, Me.dat})
Me.st1.ShowPanels = True
Me.st1.Size = New System.Drawing.Size(448, 22)
Me.st1.TabIndex = 1
'
'time
'
Me.time.Alignment = System.Windows.Forms.HorizontalAlignment.Center
Me.time.Width = 200
'
'pname
'
Me.pname.Alignment = System.Windows.Forms.HorizontalAlignment.Center
Me.pname.BorderStyle = System.Windows.Forms.StatusBarPanelBorderStyle.Raised
Me.pname.Icon = CType(resources.GetObject("pname.Icon"), System.Drawing.Icon)
Me.pname.Text = "Library Management System"
Me.pname.Width = 400
'
'dat
'
Me.dat.Alignment = System.Windows.Forms.HorizontalAlignment.Center
Me.dat.Width = 200
'
'MainMenu
'
Me.MainMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menu1, Me.menu2, Me.menu3, Me.menu4, Me.menu5})
'
'menu1
'
Me.menu1.Index = 0
Me.menu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnu_close, Me.mnu_exit})
Me.menu1.Text = "&File"
'
'mnu_close
'
Me.mnu_close.Index = 0
Me.mnu_close.Text = "&Close"
'
'mnu_exit
'
Me.mnu_exit.Index = 1
Me.mnu_exit.Text = "E&xit"
'
'menu2
'
Me.menu2.Index = 1
Me.menu2.MdiList = True
Me.menu2.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnu_trans, Me.mnu_studinfo, Me.mnu_bookinfo})
Me.menu2.Text = "&View"
'
'mnu_trans
'
Me.mnu_trans.Index = 0
Me.mnu_trans.Shortcut = System.Windows.Forms.Shortcut.CtrlI
Me.mnu_trans.Text = "&Issue / Return Books"
'
'mnu_studinfo
'
Me.mnu_studinfo.Index = 1
Me.mnu_studinfo.Shortcut = System.Windows.Forms.Shortcut.CtrlK
Me.mnu_studinfo.Text = "Add Student Info."
'
'mnu_bookinfo
'
Me.mnu_bookinfo.Index = 2
Me.mnu_bookinfo.Shortcut = System.Windows.Forms.Shortcut.CtrlB
Me.mnu_bookinfo.Text = "Add &Book Info."
'
'menu3
'
Me.menu3.Index = 2
Me.menu3.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnu_options, Me.mnu_chngpass})
Me.menu3.Text = "&Tools"
'
'mnu_options
'
Me.mnu_options.Index = 0
Me.mnu_options.Text = "&Options"
'
'mnu_chngpass
'
Me.mnu_chngpass.Index = 1
Me.mnu_chngpass.Text = "&Change Password"
'
'menu4
'
Me.menu4.Index = 3
Me.menu4.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
Me.menu4.Text = "&Reports"
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.Text = "&Dues Report"
'
'menu5
'
Me.menu5.Index = 4
Me.menu5.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnu_index, Me.MenuItem11, Me.mnu_about})
Me.menu5.Text = "&Help"
'
'mnu_index
'
Me.mnu_index.Index = 0
Me.mnu_index.Text = "&Index"
'
'MenuItem11
'
Me.MenuItem11.Index = 1
Me.MenuItem11.Text = "-"
'
'mnu_about
'
Me.mnu_about.Index = 2
Me.mnu_about.Text = "&About"
'
'Timer1
'
Me.Timer1.Interval = 1000
'
'main_form
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(448, 349)
Me.Controls.Add(Me.st1)
Me.IsMdiContainer = True
Me.Menu = Me.MainMenu
Me.Name = "main_form"
Me.Text = "Library Management System"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
CType(Me.time, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.pname, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.dat, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub main_form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'setting up panels
st1.Panels(2).Text = Date.Today.ToLongDateString
Timer1.Enabled = True
'disabling main menus
menu1.Enabled = False
menu2.Enabled = False
menu3.Enabled = False
menu4.Enabled = False
menu5.Enabled = False
'loading login form
Dim frm As New login
frm.MdiParent = Me
frm.Show()
End Sub
Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_trans.Click
closechild()
Dim frmt As New transaction
frmt.MdiParent = Me
frmt.Show()
End Sub
Public Sub closechild()
Dim f As New Form
f = Me.ActiveMdiChild
If Not f Is Nothing Then
f.Close()
End If
End Sub
Private Sub MenuItem8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_studinfo.Click
closechild()
Dim frms As New students
frms.MdiParent = Me
frms.Show()
End Sub
Private Sub MenuItem9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_bookinfo.Click
closechild()
Dim frmb As New books
frmb.MdiParent = Me
frmb.Show()
End Sub
Private Sub MenuItem13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_options.Click
closechild()
Dim frmo As New options
frmo.MdiParent = Me
frmo.Show()
End Sub
Private Sub MenuItem15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_chngpass.Click
closechild()
Dim frmcp As New change_pass
frmcp.MdiParent = Me
frmcp.Show()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
st1.Panels(0).Text = Format(Now.ToLongTimeString)
End Sub
Private Sub mnu_exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_exit.Click
Dim res As MsgBoxResult
res = MessageBox.Show("Are you sure,you want to exit?", "LMS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If res = MsgBoxResult.Yes Then
Me.Dispose()
End If
End Sub
Private Sub main_form_closing(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim res As MsgBoxResult
res = MessageBox.Show("Are you sure,you want to exit?", "LMS", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If res = MsgBoxResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
End Sub
Private Sub mnu_about_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_about.Click
Dim abt As New about
abt.Show()
End Sub
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click
closechild()
Dim frm_rpt As New report
frm_rpt.MdiParent = Me
frm_rpt.Show()
End Sub
Private Sub mnu_close_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_close.Click
closechild()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -