📄 frmlogin.vb
字号:
Public Class frmLogin
Inherits System.Windows.Forms.Form
Public m_bLoginSuccess As Boolean '是否登录成功
#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 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Public WithEvents ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents cmdOK As System.Windows.Forms.Button
Public WithEvents cmdExit As System.Windows.Forms.Button
Public WithEvents picBG As System.Windows.Forms.Panel
Public WithEvents _lblLogin_1 As System.Windows.Forms.Label
Public WithEvents _lblLogin_2 As System.Windows.Forms.Label
Public WithEvents _lblLogin_3 As System.Windows.Forms.Label
Public WithEvents _lblLogin_0 As System.Windows.Forms.Label
Public WithEvents _lblLogin_4 As System.Windows.Forms.Label
Public WithEvents _lblLogin_5 As System.Windows.Forms.Label
Public WithEvents _lblLogin_6 As System.Windows.Forms.Label
Public WithEvents fraLogin As System.Windows.Forms.GroupBox
Public WithEvents imgloginLogo As System.Windows.Forms.PictureBox
Public WithEvents txtUser As System.Windows.Forms.TextBox
Public WithEvents txtPwd As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmLogin))
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.txtPwd = New System.Windows.Forms.TextBox
Me.cmdOK = New System.Windows.Forms.Button
Me.fraLogin = New System.Windows.Forms.GroupBox
Me.txtUser = New System.Windows.Forms.TextBox
Me.cmdExit = New System.Windows.Forms.Button
Me.picBG = New System.Windows.Forms.Panel
Me._lblLogin_3 = New System.Windows.Forms.Label
Me._lblLogin_1 = New System.Windows.Forms.Label
Me._lblLogin_2 = New System.Windows.Forms.Label
Me._lblLogin_0 = New System.Windows.Forms.Label
Me._lblLogin_4 = New System.Windows.Forms.Label
Me._lblLogin_5 = New System.Windows.Forms.Label
Me.imgloginLogo = New System.Windows.Forms.PictureBox
Me._lblLogin_6 = New System.Windows.Forms.Label
Me.fraLogin.SuspendLayout()
Me.picBG.SuspendLayout()
Me.SuspendLayout()
'
'txtPwd
'
Me.txtPwd.AcceptsReturn = True
Me.txtPwd.AutoSize = False
Me.txtPwd.BackColor = System.Drawing.SystemColors.Window
Me.txtPwd.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtPwd.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtPwd.Location = New System.Drawing.Point(124, 152)
Me.txtPwd.MaxLength = 0
Me.txtPwd.Name = "txtPwd"
Me.txtPwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtPwd.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtPwd.Size = New System.Drawing.Size(174, 22)
Me.txtPwd.TabIndex = 3
Me.txtPwd.Text = "Admin"
Me.ToolTip1.SetToolTip(Me.txtPwd, "请输入密码")
'
'cmdOK
'
Me.cmdOK.BackColor = System.Drawing.SystemColors.Control
Me.cmdOK.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdOK.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdOK.Location = New System.Drawing.Point(96, 184)
Me.cmdOK.Name = "cmdOK"
Me.cmdOK.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdOK.Size = New System.Drawing.Size(84, 25)
Me.cmdOK.TabIndex = 0
Me.cmdOK.Text = "登录(&O)"
Me.ToolTip1.SetToolTip(Me.cmdOK, "登录")
'
'fraLogin
'
Me.fraLogin.BackColor = System.Drawing.SystemColors.Control
Me.fraLogin.Controls.Add(Me.txtUser)
Me.fraLogin.Controls.Add(Me.txtPwd)
Me.fraLogin.Controls.Add(Me.cmdOK)
Me.fraLogin.Controls.Add(Me.cmdExit)
Me.fraLogin.Controls.Add(Me.picBG)
Me.fraLogin.Controls.Add(Me._lblLogin_4)
Me.fraLogin.Controls.Add(Me._lblLogin_5)
Me.fraLogin.Controls.Add(Me.imgloginLogo)
Me.fraLogin.Controls.Add(Me._lblLogin_6)
Me.fraLogin.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.fraLogin.ForeColor = System.Drawing.SystemColors.ControlText
Me.fraLogin.Location = New System.Drawing.Point(0, -8)
Me.fraLogin.Name = "fraLogin"
Me.fraLogin.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.fraLogin.Size = New System.Drawing.Size(421, 264)
Me.fraLogin.TabIndex = 5
Me.fraLogin.TabStop = False
'
'txtUser
'
Me.txtUser.AcceptsReturn = True
Me.txtUser.AutoSize = False
Me.txtUser.BackColor = System.Drawing.SystemColors.Window
Me.txtUser.Cursor = System.Windows.Forms.Cursors.IBeam
Me.txtUser.ForeColor = System.Drawing.SystemColors.WindowText
Me.txtUser.Location = New System.Drawing.Point(124, 120)
Me.txtUser.MaxLength = 0
Me.txtUser.Name = "txtUser"
Me.txtUser.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.txtUser.Size = New System.Drawing.Size(174, 22)
Me.txtUser.TabIndex = 2
Me.txtUser.Text = "Admin"
'
'cmdExit
'
Me.cmdExit.BackColor = System.Drawing.SystemColors.Control
Me.cmdExit.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdExit.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.cmdExit.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdExit.Location = New System.Drawing.Point(196, 184)
Me.cmdExit.Name = "cmdExit"
Me.cmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdExit.Size = New System.Drawing.Size(84, 25)
Me.cmdExit.TabIndex = 4
Me.cmdExit.Text = "退出(&E)"
'
'picBG
'
Me.picBG.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(128, Byte))
Me.picBG.Controls.Add(Me._lblLogin_3)
Me.picBG.Controls.Add(Me._lblLogin_1)
Me.picBG.Controls.Add(Me._lblLogin_2)
Me.picBG.Controls.Add(Me._lblLogin_0)
Me.picBG.Cursor = System.Windows.Forms.Cursors.Default
Me.picBG.ForeColor = System.Drawing.SystemColors.WindowText
Me.picBG.Location = New System.Drawing.Point(2, 9)
Me.picBG.Name = "picBG"
Me.picBG.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.picBG.Size = New System.Drawing.Size(417, 95)
Me.picBG.TabIndex = 5
'
'_lblLogin_3
'
Me._lblLogin_3.AutoSize = True
Me._lblLogin_3.BackColor = System.Drawing.Color.Transparent
Me._lblLogin_3.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLogin_3.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me._lblLogin_3.ForeColor = System.Drawing.Color.White
Me._lblLogin_3.Location = New System.Drawing.Point(50, 38)
Me._lblLogin_3.Name = "_lblLogin_3"
Me._lblLogin_3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLogin_3.Size = New System.Drawing.Size(252, 25)
Me._lblLogin_3.TabIndex = 6
Me._lblLogin_3.Text = "企业内部办公联系系统 V2.0"
'
'_lblLogin_1
'
Me._lblLogin_1.AutoSize = True
Me._lblLogin_1.BackColor = System.Drawing.Color.Transparent
Me._lblLogin_1.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLogin_1.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me._lblLogin_1.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblLogin_1.Location = New System.Drawing.Point(14, 12)
Me._lblLogin_1.Name = "_lblLogin_1"
Me._lblLogin_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLogin_1.Size = New System.Drawing.Size(63, 19)
Me._lblLogin_1.TabIndex = 9
Me._lblLogin_1.Text = "欢迎使用"
'
'_lblLogin_2
'
Me._lblLogin_2.AutoSize = True
Me._lblLogin_2.BackColor = System.Drawing.Color.Transparent
Me._lblLogin_2.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLogin_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblLogin_2.Location = New System.Drawing.Point(167, 74)
Me._lblLogin_2.Name = "_lblLogin_2"
Me._lblLogin_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLogin_2.Size = New System.Drawing.Size(208, 17)
Me._lblLogin_2.TabIndex = 8
Me._lblLogin_2.Text = "版权所有 (C) 2005-2008 特瑞飞软件"
'
'_lblLogin_0
'
Me._lblLogin_0.AutoSize = True
Me._lblLogin_0.BackColor = System.Drawing.Color.Transparent
Me._lblLogin_0.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLogin_0.Font = New System.Drawing.Font("宋体", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me._lblLogin_0.ForeColor = System.Drawing.Color.Black
Me._lblLogin_0.Location = New System.Drawing.Point(52, 40)
Me._lblLogin_0.Name = "_lblLogin_0"
Me._lblLogin_0.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLogin_0.Size = New System.Drawing.Size(203, 25)
Me._lblLogin_0.TabIndex = 7
Me._lblLogin_0.Text = "企业内部信息管理系统"
'
'_lblLogin_4
'
Me._lblLogin_4.AutoSize = True
Me._lblLogin_4.BackColor = System.Drawing.Color.Transparent
Me._lblLogin_4.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLogin_4.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblLogin_4.Location = New System.Drawing.Point(64, 120)
Me._lblLogin_4.Name = "_lblLogin_4"
Me._lblLogin_4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLogin_4.Size = New System.Drawing.Size(42, 17)
Me._lblLogin_4.TabIndex = 12
Me._lblLogin_4.Text = "用户名"
'
'_lblLogin_5
'
Me._lblLogin_5.AutoSize = True
Me._lblLogin_5.BackColor = System.Drawing.Color.Transparent
Me._lblLogin_5.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLogin_5.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblLogin_5.Location = New System.Drawing.Point(52, 152)
Me._lblLogin_5.Name = "_lblLogin_5"
Me._lblLogin_5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLogin_5.Size = New System.Drawing.Size(54, 17)
Me._lblLogin_5.TabIndex = 11
Me._lblLogin_5.Text = "登录密码"
'
'imgloginLogo
'
Me.imgloginLogo.Cursor = System.Windows.Forms.Cursors.Default
Me.imgloginLogo.Image = CType(resources.GetObject("imgloginLogo.Image"), System.Drawing.Image)
Me.imgloginLogo.Location = New System.Drawing.Point(320, 120)
Me.imgloginLogo.Name = "imgloginLogo"
Me.imgloginLogo.Size = New System.Drawing.Size(84, 93)
Me.imgloginLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.imgloginLogo.TabIndex = 13
Me.imgloginLogo.TabStop = False
'
'_lblLogin_6
'
Me._lblLogin_6.AutoSize = True
Me._lblLogin_6.BackColor = System.Drawing.Color.Transparent
Me._lblLogin_6.Cursor = System.Windows.Forms.Cursors.Default
Me._lblLogin_6.ForeColor = System.Drawing.Color.FromArgb(CType(0, Byte), CType(0, Byte), CType(192, Byte))
Me._lblLogin_6.Location = New System.Drawing.Point(72, 224)
Me._lblLogin_6.Name = "_lblLogin_6"
Me._lblLogin_6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblLogin_6.Size = New System.Drawing.Size(227, 17)
Me._lblLogin_6.TabIndex = 10
Me._lblLogin_6.Text = "注:默认登录用户:密码 是 Admin:Admin"
'
'frmLogin
'
Me.AcceptButton = Me.cmdOK
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.CancelButton = Me.cmdExit
Me.ClientSize = New System.Drawing.Size(421, 255)
Me.Controls.Add(Me.fraLogin)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmLogin"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "登录"
Me.fraLogin.ResumeLayout(False)
Me.picBG.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub frmLogin_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
m_bLoginSuccess = False
Me.Activate()
End Sub
Private Sub frmLogin_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
'用户非正常退出时才提示
If Not m_bLoginSuccess Then
If MsgBox("您确定要退出本系统吗?", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "退出系统") = MsgBoxResult.Yes Then
Application.Exit()
Else
e.Cancel = True '取消卸载窗体
End If
End If
End Sub
'用户首次登录和重新登录
Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOK.Click
Dim userObj As New InfoProSysBusiness.User
Dim ErrMsg As String
ErrMsg = userObj.Login(txtUser.Text, txtPwd.Text)
If ErrMsg <> "" Then
MsgBox(ErrMsg, MsgBoxStyle.Exclamation + MsgBoxStyle.OKOnly)
Else
'记录当前登录用户信息
userObj.getUserInfo(txtUser.Text, LoginedUserInfo)
m_bLoginSuccess = True
Me.Close()
End If
End Sub
Private Sub cmdExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdExit.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -