📄 frminit.vb
字号:
Public Class FrmInit
Inherits System.Windows.Forms.Form
Dim pwd, sf As String
Dim js As Integer = 0
#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 Panel_password As System.Windows.Forms.Panel
Friend WithEvents txtBox_pwd As System.Windows.Forms.TextBox
Friend WithEvents btn_sure As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Panel_Fill As System.Windows.Forms.Panel
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Panel_password = New System.Windows.Forms.Panel
Me.Label1 = New System.Windows.Forms.Label
Me.btn_sure = New System.Windows.Forms.Button
Me.txtBox_pwd = New System.Windows.Forms.TextBox
Me.Panel_Fill = New System.Windows.Forms.Panel
Me.Panel_password.SuspendLayout()
Me.SuspendLayout()
'
'Panel_password
'
Me.Panel_password.Controls.Add(Me.Label1)
Me.Panel_password.Controls.Add(Me.btn_sure)
Me.Panel_password.Controls.Add(Me.txtBox_pwd)
Me.Panel_password.Location = New System.Drawing.Point(392, 344)
Me.Panel_password.Name = "Panel_password"
Me.Panel_password.Size = New System.Drawing.Size(216, 64)
Me.Panel_password.TabIndex = 1
Me.Panel_password.Visible = False
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(16, 5)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(97, 17)
Me.Label1.TabIndex = 2
Me.Label1.Text = "请输入登陆密码:"
'
'btn_sure
'
Me.btn_sure.Location = New System.Drawing.Point(128, 32)
Me.btn_sure.Name = "btn_sure"
Me.btn_sure.Size = New System.Drawing.Size(64, 23)
Me.btn_sure.TabIndex = 1
Me.btn_sure.Text = "确定(&S)"
'
'txtBox_pwd
'
Me.txtBox_pwd.Location = New System.Drawing.Point(16, 32)
Me.txtBox_pwd.Name = "txtBox_pwd"
Me.txtBox_pwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtBox_pwd.TabIndex = 0
Me.txtBox_pwd.Text = ""
'
'Panel_Fill
'
Me.Panel_Fill.Dock = System.Windows.Forms.DockStyle.Fill
Me.Panel_Fill.Location = New System.Drawing.Point(0, 0)
Me.Panel_Fill.Name = "Panel_Fill"
Me.Panel_Fill.Size = New System.Drawing.Size(1028, 753)
Me.Panel_Fill.TabIndex = 2
'
'FrmInit
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(1028, 753)
Me.Controls.Add(Me.Panel_password)
Me.Controls.Add(Me.Panel_Fill)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Name = "FrmInit"
Me.StartPosition = System.Windows.Forms.FormStartPosition.WindowsDefaultBounds
Me.Text = "界桩信息管理系统"
Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
Me.Panel_password.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
'----------------------------------------------
' 窗体加载
'----------------------------------------------
Private Sub FrmInit_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim pic_name As String = System.Configuration.ConfigurationSettings.AppSettings("picture_main")
Panel_Fill.BackgroundImage = Image.FromFile(pic_name)
Catch ex As System.IO.FileNotFoundException
MsgBox("找不到背景图片,请检查程序文件夹!", MsgBoxStyle.Exclamation Or MsgBoxStyle.OKOnly, "系统提示")
Catch ex As Exception
MsgBox(ex.ToString())
MsgBox("系统错误,请检查重启!", MsgBoxStyle.Exclamation Or MsgBoxStyle.OKOnly, "系统提示")
Application.Exit()
End Try
pwd = System.Configuration.ConfigurationSettings.AppSettings("pwd")
sf = System.Configuration.ConfigurationSettings.AppSettings("is")
End Sub
'----------------------------------------------
' 进入管理系统
'----------------------------------------------
Private Sub Panel_Fill_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Panel_Fill.Click
If sf.Equals("no") Then
AppModule.frmMain.Show()
Me.Hide()
Else
Panel_password.Visible = True
txtBox_pwd.Focus()
End If
End Sub
'----------------------------------------------
' 验证密码事件
'----------------------------------------------
Private Sub btn_sure_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_sure.Click
If (pwd.Equals(txtBox_pwd.Text.Trim())) Then
AppModule.frmMain.Show()
Me.Hide()
Else
'js = js + 1
MessageBox.Show("登陆密码错误请重新输入!", "系统提醒!", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
With txtBox_pwd
.Clear()
.Focus()
End With
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -