📄 mainform.vb
字号:
Me.BackgroundImage = New Bitmap(Me.MyBgPhotoShow, True)
Me.Text = MySlogan
End Sub
Private Sub 公司部门设置ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 公司部门设置ToolStripMenuItem.Click
Dim MyDlg As New DepartmentForm()
MyDlg.ShowDialog()
End Sub
Private Sub 系统帮助信息ToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 系统帮助信息ToolStripMenuItem.Click
Dim MyDlg As New VersionForm()
MyDlg.label1.Text = Me.MySlogan
MyDlg.ShowDialog()
End Sub
Private Sub 退出系统EToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles 退出系统EToolStripMenuItem.Click, 退出系统ToolStripButton.Click
If (MessageBox.Show("您确定现在退出本系统吗?", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes) Then
Me.Close()
End If
End Sub
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'添加ThreadException事件关联程序
AddHandler Application.ThreadException, AddressOf MyThreadException
'从公司信息数据表中读取基本信息
GetCompanyInformation()
'显示登录对话框
Dim MyDlg As New LoginForm()
MyDlg.Text = "欢迎使用" + MySlogan
MyDlg.ShowDialog(Me)
Me.MyOperator = MyDlg.用户名称TextBox.Text
'根据用户的操作权限配置系统菜单
SetUserOperateMenu()
'最大化显示系统主窗体
If (MyOperator.Length > 0) Then
Me.WindowState = FormWindowState.Maximized
End If
'设置系统背景图像信息
Me.BackgroundImage = New Bitmap(Me.MyBgPhotoShow, True)
'设置系统标题栏显示文字
Me.Text = MySlogan
End Sub
'系统异常处理代码
Public Sub MyThreadException(ByVal sender As Object, ByVal e As System.Threading.ThreadExceptionEventArgs)
Dim MyInfo As String = "错误名称:" + e.Exception.Source + ",错误信息:" + e.Exception.Message
MessageBox.Show(MyInfo, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Protected Overrides Sub WndProc(ByRef SystemMessage As Message)
If SystemMessage.Msg = 274 Then
If ((SystemMessage.WParam) = 61536) Then
退出系统EToolStripMenuItem_Click(Nothing, Nothing)
Else
MyBase.WndProc(SystemMessage)
End If
Else
MyBase.WndProc(SystemMessage)
End If
End Sub
'从公司信息数据表中读取基本信息
Public Sub GetCompanyInformation()
Dim MySQLConnectionString As String = My.Settings.MyAssetsConnectionString
Dim MySQL As String = "Select * From 公司信息 Where 显示优先级=1"
Dim MyConnection As New SqlConnection(MySQLConnectionString)
MyConnection.Open()
Dim MyTable As New DataTable()
Dim MyAdapter As New SqlDataAdapter(MySQL, MyConnection)
MyAdapter.Fill(MyTable)
MyBgPhoto = Application.StartupPath + "\Data\" + MyTable.Rows(0)("管理系统背景照片")
MyAddress = MyTable.Rows(0)("公司地址")
MyTel = MyTable.Rows(0)("服务电话")
MyCode = MyTable.Rows(0)("邮政编码")
MyWeb = MyTable.Rows(0)("公司网站")
MySlogan = MyTable.Rows(0)("管理系统显示名称")
MyCompany = MyTable.Rows(0)("公司名称")
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
MyBgPhotoShow = Application.StartupPath + "\Data\Show" + MyTable.Rows(0)("管理系统背景照片")
End Sub
'根据用户的操作权限配置系统菜单
Public Sub SetUserOperateMenu()
Dim MySQLConnectionString As String = My.Settings.MyAssetsConnectionString
Dim MySQL As String = "Select * From 操作用户 Where 用户名称='" + Me.MyOperator + "'"
Dim MyConnection As New SqlConnection(MySQLConnectionString)
MyConnection.Open()
Dim MyTable As New DataTable()
Dim MyAdapter As New SqlDataAdapter(MySQL, MyConnection)
MyAdapter.Fill(MyTable)
If (MyTable.Rows(0)("固定资产管理之增加固定资产") = 0) Then
Me.增加固定资产ToolStripMenuItem.Visible = False
Me.增加固定资产ToolStripSeparator.Visible = False
Me.增加固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("固定资产管理之减少固定资产") = 0) Then
Me.减少固定资产ToolStripMenuItem.Visible = False
Me.减少固定资产ToolStripSeparator.Visible = False
Me.减少固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("固定资产管理之借出固定资产") = 0) Then
Me.借出固定资产ToolStripMenuItem.Visible = False
Me.借出固定资产ToolStripSeparator.Visible = False
Me.借出固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("固定资产管理之归还固定资产") = 0) Then
Me.归还固定资产ToolStripMenuItem.Visible = False
Me.归还固定资产ToolStripSeparator.Visible = False
Me.归还固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("固定资产管理之送修固定资产") = 0) Then
Me.送修固定资产ToolStripMenuItem.Visible = False
Me.送修固定资产ToolStripSeparator.Visible = False
Me.送修固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("固定资产管理之完修固定资产") = 0) Then
Me.完修固定资产ToolStripMenuItem.Visible = False
Me.送修固定资产ToolStripSeparator.Visible = False
Me.完修固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("折旧管理之计算月度折旧") = 0) Then
Me.计算月度折旧ToolStripMenuItem.Visible = False
Me.计算月度折旧ToolStripSeparator.Visible = False
Me.计算月度折旧ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("折旧管理之统计月度折旧") = 0) Then
Me.统计月度折旧ToolStripMenuItem.Visible = False
Me.统计月度折旧ToolStripSeparator.Visible = False
Me.统计月度折旧ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("折旧管理之汇总月度折旧") = 0) Then
Me.汇总月度折旧ToolStripMenuItem.Visible = False
Me.统计月度折旧ToolStripSeparator.Visible = False
Me.汇总月度折旧ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("报表管理之固定资产卡片") = 0) Then
Me.固定资产卡片ToolStripMenuItem.Visible = False
Me.固定资产卡片ToolStripSeparator.Visible = False
Me.固定资产卡片ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("报表管理之固定资产折旧") = 0) Then
Me.固定资产折旧ToolStripMenuItem.Visible = False
Me.固定资产折旧ToolStripSeparator.Visible = False
Me.固定资产折旧ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("报表管理之部门固定资产") = 0) Then
Me.部门固定资产ToolStripMenuItem.Visible = False
Me.部门固定资产ToolStripSeparator.Visible = False
Me.部门固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("报表管理之分类固定资产") = 0) Then
Me.分类固定资产ToolStripMenuItem.Visible = False
Me.分类固定资产ToolStripSeparator.Visible = False
Me.分类固定资产ToolStripButton.Visible = False
End If
If (MyTable.Rows(0)("报表管理之减少固定资产") = 0) Then
Me.减少固定资产ToolStripMenuItem1.Visible = False
Me.减少固定资产ToolStripSeparator1.Visible = False
Me.减少固定资产ToolStripButton1.Visible = False
End If
If (MyTable.Rows(0)("报表管理之送修固定资产") = 0) Then
Me.送修固定资产ToolStripMenuItem1.Visible = False
Me.送修固定资产ToolStripSeparator1.Visible = False
Me.送修固定资产ToolStripButton1.Visible = False
End If
If (MyTable.Rows(0)("报表管理之完修固定资产") = 0) Then
Me.完修固定资产ToolStripMenuItem1.Visible = False
Me.完修固定资产ToolStripSeparator1.Visible = False
Me.完修固定资产ToolStripButton1.Visible = False
End If
If (MyTable.Rows(0)("报表管理之出借固定资产") = 0) Then
Me.出借固定资产ToolStripMenuItem1.Visible = False
Me.出借固定资产ToolStripSeparator1.Visible = False
Me.出借固定资产ToolStripButton1.Visible = False
End If
If (MyTable.Rows(0)("报表管理之归还固定资产") = 0) Then
Me.归还固定资产ToolStripMenuItem1.Visible = False
Me.出借固定资产ToolStripSeparator1.Visible = False
Me.归还固定资产ToolStripButton1.Visible = False
End If
If (MyTable.Rows(0)("系统管理之操作权限设置") = 0) Then
Me.操作权限设置ToolStripMenuItem.Visible = False
Me.操作权限设置ToolStripSeparator.Visible = False
End If
If (MyTable.Rows(0)("系统管理之公司信息设置") = 0) Then
Me.公司信息设置ToolStripMenuItem.Visible = False
Me.公司信息设置ToolStripSeparator.Visible = False
End If
If (MyTable.Rows(0)("系统管理之公司部门设置") = 0) Then
Me.公司部门设置ToolStripMenuItem.Visible = False
Me.公司部门设置ToolStripSeparator.Visible = False
End If
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -