📄 main.vb
字号:
frmMenu.Show()
End If
End Sub
Public Function OpenOnce(ByVal myform As Form) As Boolean
Dim form As Form
For Each form In Me.MdiChildren
If form.Text = myform.Text Then
form.Activate()
Return True
End If
Next
Return False
End Function
Private Sub menuResure_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuResure.Click
Dim frmres As New Form3()
If OpenOnce(frmres) = False Then
frmres.MdiParent = Me
frmres.Show()
End If
End Sub
Private Sub menuCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuCustomer.Click
Dim frmbill As New Form4()
If OpenOnce(frmbill) = False Then
frmbill.MdiParent = Me
frmbill.Show()
End If
End Sub
Private Sub menuChkBill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuChkBill.Click
Dim frmcheck As New Form5()
If OpenOnce(frmcheck) = False Then
frmcheck.MdiParent = Me
frmcheck.Show()
End If
End Sub
Private Sub menuEngageOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuEngageOrder.Click
Dim frmbook As New Form6()
If OpenOnce(frmbook) = False Then
frmbook.MdiParent = Me
frmbook.Show()
End If
End Sub
Private Sub menuEngageSvc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuEngageSvc.Click
End Sub
Private Sub menuExpandOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuExpandOrder.Click
Dim frmout As New Form7()
If OpenOnce(frmout) = False Then
frmout.MdiParent = Me
frmout.Show()
End If
End Sub
Private Sub menuTransSvc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuTransSvc.Click
Dim frmtrans As New Form8()
If OpenOnce(frmtrans) = False Then
frmtrans.MdiParent = Me
frmtrans.Show()
End If
End Sub
Private Sub TreeView1_DoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles TreeView1.DoubleClick
Dim curNode As TreeNode
curNode = New TreeNode()
curNode = Me.TreeView1.SelectedNode
If curNode.Parent Is Nothing Then
Else
Select Case curNode.Text
Case "点菜菜谱"
If mod1 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuMenu_Click(Nothing, Nothing)
Case "浏览资源"
If mod1 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuResure_Click(Nothing, Nothing)
Case "登记账单"
If mod1 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuCustomer_Click(Nothing, Nothing)
Case "结账清单"
If mod1 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuChkBill_Click(Nothing, Nothing)
Case "预定订单"
If mod2 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuEngageOrder_Click(Nothing, Nothing)
Case "酒宴服务"
If mod2 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuEngageSvc_Click(Nothing, Nothing)
Case "外卖订单"
If mod3 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuExpandOrder_Click(Nothing, Nothing)
Case "送货服务"
If mod3 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuTransSvc_Click(Nothing, Nothing)
Case "员工管理"
If mod4 = False Then
MsgBox("对不起,你没有这个权限管理该模块。", _
MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "无权限访问")
Exit Sub
End If
menuClerk_Click(Nothing, Nothing)
End Select
End If
End Sub
Private Sub menuEmail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuEmail.Click
System.Diagnostics.Process.Start("mailto:hzchao2001@etang.com")
End Sub
Private Sub menuHelpContent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuHelpContent.Click
MsgBox("对不起,没有相关帮助内容,请参阅本书附录一自己制作帮助文件。", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "暂无帮助内容")
End Sub
Private Sub menuSupport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuSupport.Click
System.Diagnostics.Process.Start("http://www.chinaspx.com")
End Sub
Private Sub Form1_Closing(ByVal sender As Object, _
ByVal e As System.ComponentModel.CancelEventArgs) _
Handles MyBase.Closing
If MsgBox("您真的要退出餐饮服务管理系统吗?", _
MsgBoxStyle.YesNo + MsgBoxStyle.Question, "退出系统") _
= MsgBoxResult.Yes Then
Application.Exit()
Else
e.Cancel = True
End If
End Sub
Private Sub menuAbout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuAbout.Click
MsgBox("对不起,没有关于信息", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation, "暂无关于信息")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Authority()
StatusBar()
Me.Timer1.Enabled = True
Me.StatusBarPanel3.Text = UserName
End Sub
Public Function Authority()
If pepdom = 0 Then
menuSystem.Enabled = True
menuForeSvc.Enabled = False
menuOrderSvc.Enabled = False
menuExpandSvc.Enabled = False
menuEmployee.Enabled = False
End If
If pepdom = 1 Then
menuSystem.Enabled = True
menuForeSvc.Enabled = False
menuOrderSvc.Enabled = False
menuExpandSvc.Enabled = False
menuEmployee.Enabled = True
End If
If pepdom = 2 Then
menuSystem.Enabled = False
menuForeSvc.Enabled = mod1
menuOrderSvc.Enabled = mod2
menuExpandSvc.Enabled = mod3
menuEmployee.Enabled = mod4
End If
End Function
Private Sub menuUser_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuUser.Click
Dim frmuser As New Form12()
If OpenOnce(frmuser) = False Then
frmuser.MdiParent = Me
frmuser.Show()
End If
End Sub
Private Sub TreeView1_AfterSelect(ByVal sender As Object, _
ByVal e As System.Windows.Forms.TreeViewEventArgs) _
Handles TreeView1.AfterSelect
If mod1 = False Then
If e.Node.Text = "前台营业管理" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
If mod2 = False Then
If e.Node.Text = "预定酒宴服务" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
If mod3 = False Then
If e.Node.Text = "扩展外卖服务" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
If mod4 = False Then
If e.Node.Text = "员工管理" Then
MsgBox("对不起,你没有这个权限管理该模块。", MsgBoxStyle.OKOnly + _
MsgBoxStyle.Exclamation, "无权限访问")
e.Node.Collapse()
Exit Sub
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Me.Button1.ImageIndex = 1 Then
Me.Button1.ImageIndex = 2
Me.Timer2.Enabled = False
Else
Me.Button1.ImageIndex = 1
Me.Timer2.Enabled = True
End If
End Sub
Private Sub Timer1_Tick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Timer1.Tick
Dim WeekdayName As String
Me.StatusBarPanel4.Text = Now.ToLongTimeString
If Now.DayOfWeek = DayOfWeek.Sunday Then WeekdayName = "星期天"
If Now.DayOfWeek = DayOfWeek.Monday Then WeekdayName = "星期一"
If Now.DayOfWeek = DayOfWeek.Tuesday Then WeekdayName = "星期二"
If Now.DayOfWeek = DayOfWeek.Wednesday Then WeekdayName = "星期三"
If Now.DayOfWeek = DayOfWeek.Thursday Then WeekdayName = "星期四"
If Now.DayOfWeek = DayOfWeek.Friday Then WeekdayName = "星期五"
If Now.DayOfWeek = DayOfWeek.Saturday Then WeekdayName = "星期六"
Me.StatusBarPanel4.ToolTipText = Now.ToLongDateString & " , " & WeekdayName
If Me.MdiChildren.GetLength(0) = 0 Then
Me.menuClsAll.Enabled = False
Else
Me.menuClsAll.Enabled = True
End If
End Sub
Private Sub Timer2_Tick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Timer2.Tick
Dim CursorPos As System.Drawing.Point
CursorPos = Cursor.Position
Dim disX As Integer
disX = CursorPos.X - Me.Panel1.Left
If Math.Abs(disX) < Me.Panel1.Width + 10 Then
If Me.Panel1.Width < 220 Then
Me.Panel1.Width += 20
End If
Else
If Me.Panel1.Width > 15 Then
Me.Panel1.Width -= 20
End If
End If
End Sub
Private Sub menuDie_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuDie.Click
Me.LayoutMdi(MdiLayout.Cascade)
End Sub
Private Sub menuHorizon_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuHorizon.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
End Sub
Private Sub menuVertify_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuVertify.Click
Me.LayoutMdi(MdiLayout.TileVertical)
End Sub
Private Sub menuClsAll_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles menuClsAll.Click
Dim frmChild As Form
For Each frmChild In Me.MdiChildren
frmChild.Close()
Next
End Sub
Private Sub menuMMenu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuMMenu.Click
Dim frmout As New Form2()
If OpenOnce(frmout) = False Then
frmout.MdiParent = Me
frmout.Show()
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -