📄 form1.vb
字号:
'
'RadioButton2
'
Me.RadioButton2.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left)
Me.RadioButton2.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.RadioButton2.Font = New System.Drawing.Font("华文新魏", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.RadioButton2.ForeColor = System.Drawing.Color.FromArgb(CType(0, Byte), CType(0, Byte), CType(192, Byte))
Me.RadioButton2.Location = New System.Drawing.Point(120, 24)
Me.RadioButton2.Name = "RadioButton2"
Me.RadioButton2.TabIndex = 1
Me.RadioButton2.Text = "紧急处理"
'
'RadioButton1
'
Me.RadioButton1.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left)
Me.RadioButton1.Checked = True
Me.RadioButton1.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.RadioButton1.Font = New System.Drawing.Font("华文新魏", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.RadioButton1.ForeColor = System.Drawing.Color.FromArgb(CType(0, Byte), CType(0, Byte), CType(192, Byte))
Me.RadioButton1.Location = New System.Drawing.Point(8, 24)
Me.RadioButton1.Name = "RadioButton1"
Me.RadioButton1.TabIndex = 0
Me.RadioButton1.TabStop = True
Me.RadioButton1.Text = "正常收费"
'
'HelpProvider1
'
Me.HelpProvider1.HelpNamespace = "F:\社会工作\铁道出版社\工程项目\第五章 高速公路收费系统\bin\高速公路收费系统帮助.chm"
'
'Form1
'
Me.AcceptButton = Me.Button3
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(722, 441)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1, Me.StatusBar1})
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.HelpProvider1.SetShowHelp(Me, True)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "全国高速公路收费系统"
CType(Me.StatusBarPanel1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.StatusBarPanel2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.StatusBarPanel3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.StatusBarPanel4, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox4.ResumeLayout(False)
CType(Me.Cell1, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox3.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Public Function InitionCell()
Dim i, j As Integer
With Cell1
.ShowGridLine(0, .GetCurSheet)
'不能拖动数据
.AllowDrop = False
'不允许在列单元中改变大小
.AllowExtend = False
'不允许在行单元中改变大小
.SetRows(7, .GetCurSheet) : .SetCols(7, .GetCurSheet)
'设置总共的行列属
.SetRowHeight(0, 150, 1, .GetCurSheet)
.SetColWidth(0, 100, 1, .GetCurSheet)
.SetColWidth(0, 100, 7, .GetCurSheet)
For i = 2 To 5
.SetRowHeight(0, 100, i, .GetCurSheet)
.SetColWidth(0, 300, i, .GetCurSheet)
Next
.SetRowHeight(0, 100, 7, .GetCurSheet)
'设置特殊行列的高度和宽度
.DrawGridLine(2, 2, 5, 5, 0, 2, .FindColorIndex(RGB(255, 255, 0), 0))
.DrawGridLine(2, 2, 5, 5, 1, 3, .FindColorIndex(RGB(255, 255, 0), 0))
'绘制区域中表格线的大小、样式、颜色
.MergeCells(1, 1, 6, 1)
.MergeCells(1, 7, 6, 7)
.MergeCells(3, 2, 5, 2)
'合并一些行列
For i = 1 To 5
For j = 1 To 5
.SetCellAlign(i, j, .GetCurSheet, 32)
'设置Cell组件的文本排列方式
Next
Next
.SetCellAlign(1, 1, .GetCurSheet, 4 + 32)
'设置单元格中文本的排列方式
.SetCellString(1, 1, .GetCurSheet, "过往车辆收费票据")
.SetCellFont(1, 1, .GetCurSheet, .FindFontIndex("隶书", 1))
.SetCellFontSize(1, 1, .GetCurSheet, 16)
.SetCellString(2, 2, .GetCurSheet, "车型代码:")
.SetCellFont(2, 2, .GetCurSheet, .FindFontIndex("隶书", 1))
.SetCellString(2, 3, .GetCurSheet, "入站口代码:")
.SetCellFont(2, 3, .GetCurSheet, .FindFontIndex("隶书", 1))
.SetCellString(2, 4, .GetCurSheet, "行驶距离(公里)")
.SetCellFont(2, 4, .GetCurSheet, .FindFontIndex("隶书", 1))
.SetCellString(2, 5, .GetCurSheet, "收费员代码:")
.SetCellFont(2, 5, .GetCurSheet, .FindFontIndex("隶书", 1))
.SetCellString(4, 3, .GetCurSheet, "收费站代码:")
.SetCellFont(4, 3, .GetCurSheet, .FindFontIndex("隶书", 1))
.SetCellString(4, 4, .GetCurSheet, "收取金额:")
.SetCellFont(4, 4, .GetCurSheet, .FindFontIndex("隶书", 1))
.SetCellString(4, 5, .GetCurSheet, "收费日期:")
.SetCellFont(4, 5, .GetCurSheet, .FindFontIndex("隶书", 1))
'设置一些单元格中的文本和字体
.Readonly = True
'设置Cell组件的只读属性
.ShowSheetLabel(0, .GetCurSheet)
.ShowSideLabel(0, .GetCurSheet)
.ShowTopLabel(0, .GetCurSheet)
End With
End Function
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
IsStar = True
'开始启动本系统
Me.Timer1.Enabled = IsStar
'设置计时器开始计数
Call InitionCell()
'调用初始化Cell组件的函数
Call SetStatus()
'调用设置状态栏的函数,标识出登录者的身份
Call PurAllot()
'调用权限分配的函数,给不同的登录身份者分配不同的使用权限
Call IniSystem()
'调用获取收费标准的函数
Call GetLocalCS()
'调用获取本地收费站的函数,来获取本地收费站的代码和名称
HelpProvider1.GetHelpString(Me)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Timer1.Tick
Me.StatusBarPanel4.Text = Now.ToLongTimeString
'设置和获取系统的当前时间,精确到秒钟
End Sub
Public Function SetStatus()
If User = "" Then
Me.StatusBarPanel2.Text = "系统管理员"
Else
Me.StatusBarPanel2.Text = "操作员: " & User
End If
'设置状态栏的函数,标识出登录者的身份
End Function
Public Function PurAllot()
If IsAdmin = True Then
Me.MenuItem3.Enabled = False
'不可以进行业务操作
Me.MenuItem1.Enabled = True
'可以进行系统管理
Me.MenuItem11.Enabled = True
'可以修改、管理数据字典
Me.TextBox1.ReadOnly = True
Me.Button1.Enabled = False
Me.Button2.Enabled = False
Me.Button3.Enabled = False
'不能进行业务操作
Else
Me.MenuItem3.Enabled = True
Me.MenuItem5.Enabled = False
Me.MenuItem8.Enabled = False
Me.MenuItem9.Enabled = False
Me.MenuItem12.Enabled = False
Me.TextBox1.ReadOnly = False
Me.Button1.Enabled = False
Me.Button2.Enabled = False
Me.Button3.Enabled = True
'不是管理员的权限与之相对应
Cell1.SetCellString(3, 5, Cell1.GetCurSheet, User)
'自动填充收费员代码
End If
End Function
Private Sub MenuItem20_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MenuItem20.Click
MessageBox.Show("对不起,本系统没有编制帮助文档和帮助主题。", _
"无帮助主题", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Sub
Private Sub MenuItem22_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MenuItem22.Click
MessageBox.Show("对不起,本系统没有编制关于窗体和关于本系统的信息。", _
"无关于信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Sub
Private Sub MenuItem15_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MenuItem15.Click
Dim IsWork As Boolean
IsWork = Me.MenuItem15.Checked
'获取菜单是否有被选中标记
Me.RadioButton1.Checked = Not IsWork
'将单选按钮的选中标记改变一次,以保证一致性
IsWork = Not IsWork
'改变菜单的标记状态,以下类似
End Sub
Private Sub MenuItem16_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MenuItem16.Click
Dim IsWork As Boolean
IsWork = Me.MenuItem16.Checked
Me.RadioButton2.Checked = Not IsWork
IsWork = Not IsWork
End Sub
Private Sub MenuItem17_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MenuItem17.Click
Dim IsWork As Boolean
IsWork = Me.MenuItem17.Checked
Me.RadioButton4.Checked = Not IsWork
IsWork = Not IsWork
End Sub
Private Sub MenuItem18_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MenuItem18.Click
Dim IsWork As Boolean
IsWork = Me.MenuItem18.Checked
Me.RadioButton3.Checked = Not IsWork
IsWork = Not IsWork
End Sub
Private Sub MenuItem19_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MenuItem19.Click
Dim IsWork As Boolean
IsWork = Me.MenuItem19.Checked
Me.RadioButton5.Checked = Not IsWork
IsWork = Not IsWork
End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles RadioButton1.CheckedChanged
Me.MenuItem15.Checked = Me.RadioButton1.Checked
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -