📄 frmlogin.vb
字号:
Public Class frmLogin
Inherits System.Windows.Forms.Form
Public IsLogSuccess As Boolean
Public strLogUser As String
#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 Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents btnLogin As System.Windows.Forms.Button
Friend WithEvents btnExit As System.Windows.Forms.Button
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents txtUser As System.Windows.Forms.TextBox
Friend WithEvents txtPwd As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmLogin))
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.txtUser = New System.Windows.Forms.TextBox
Me.txtPwd = New System.Windows.Forms.TextBox
Me.btnLogin = New System.Windows.Forms.Button
Me.btnExit = New System.Windows.Forms.Button
Me.Panel1 = New System.Windows.Forms.Panel
Me.Label3 = New System.Windows.Forms.Label
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.Label4 = New System.Windows.Forms.Label
Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label1.Location = New System.Drawing.Point(53, 98)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(48, 17)
Me.Label1.TabIndex = 0
Me.Label1.Text = "用户名:"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Label2.Location = New System.Drawing.Point(53, 138)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(35, 17)
Me.Label2.TabIndex = 1
Me.Label2.Text = "密码:"
'
'txtUser
'
Me.txtUser.BackColor = System.Drawing.Color.White
Me.txtUser.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txtUser.Location = New System.Drawing.Point(128, 96)
Me.txtUser.Name = "txtUser"
Me.txtUser.Size = New System.Drawing.Size(176, 21)
Me.txtUser.TabIndex = 0
Me.txtUser.Text = ""
'
'txtPwd
'
Me.txtPwd.BackColor = System.Drawing.Color.White
Me.txtPwd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txtPwd.Location = New System.Drawing.Point(128, 136)
Me.txtPwd.Name = "txtPwd"
Me.txtPwd.PasswordChar = Microsoft.VisualBasic.ChrW(42)
Me.txtPwd.Size = New System.Drawing.Size(176, 21)
Me.txtPwd.TabIndex = 1
Me.txtPwd.Text = ""
'
'btnLogin
'
Me.btnLogin.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.btnLogin.Location = New System.Drawing.Point(103, 168)
Me.btnLogin.Name = "btnLogin"
Me.btnLogin.Size = New System.Drawing.Size(52, 24)
Me.btnLogin.TabIndex = 2
Me.btnLogin.Text = "登陆"
'
'btnExit
'
Me.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.btnExit.Location = New System.Drawing.Point(199, 168)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(52, 24)
Me.btnExit.TabIndex = 3
Me.btnExit.Text = "退出"
'
'Panel1
'
Me.Panel1.Controls.Add(Me.Label3)
Me.Panel1.Controls.Add(Me.PictureBox1)
Me.Panel1.Controls.Add(Me.Label4)
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top
Me.Panel1.Location = New System.Drawing.Point(0, 0)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(354, 80)
Me.Panel1.TabIndex = 4
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.BackColor = System.Drawing.Color.White
Me.Label3.Font = New System.Drawing.Font("幼圆", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label3.Location = New System.Drawing.Point(88, 16)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(233, 24)
Me.Label3.TabIndex = 1
Me.Label3.Text = "图书馆管理信息系统 V1.0"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(16, 16)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(48, 48)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.BackColor = System.Drawing.Color.White
Me.Label4.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label4.Location = New System.Drawing.Point(88, 48)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(190, 17)
Me.Label4.TabIndex = 5
Me.Label4.Text = "中国矿业大学 翟靖轩 设计(2004)"
Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'frmLogin
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(354, 199)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.btnExit)
Me.Controls.Add(Me.btnLogin)
Me.Controls.Add(Me.txtPwd)
Me.Controls.Add(Me.txtUser)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmLogin"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "登陆"
Me.Panel1.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
IsLogSuccess = False
' Me.btnLogin.PerformClick()
End Sub
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click
'IsLogSuccess = True
IsLogSuccess = validateLogin(Me.txtUser.Text.Trim, Me.txtPwd.Text.Trim)
If IsLogSuccess = True Then
strLogUser = Me.txtUser.Text.Trim
Me.Close()
Else
MessageBox.Show("密码错误!", "请重新登陆!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
Dim grbrush As Drawing2D.LinearGradientBrush
grbrush = New Drawing2D.LinearGradientBrush(New Point(0, 0), _
New Point(sender.Width, sender.Height), Color.DarkSlateGray, Color.White)
sender.CreateGraphics.FillRectangle(grbrush, New Rectangle(0, 0, sender.Width, sender.Height))
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -