📄 frm_login.vb
字号:
#End Region
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\PIS.mdb")
Dim MyCommand
Dim e As Exception
Dim MyCommand2
Dim MyReader As OleDbDataReader
Dim MyReader2 As OleDbDataReader
Dim ref
Dim currenttime As Date
Dim tim = currenttime.Now().ToShortTimeString
#Region "CODE STARTS HERE"
Function showmain()
ref = New frm_main
ref.show()
End Function
Function verify() As Boolean
If TextBox2.Text = TextBox3.Text And empty() = False Then
Return True
Else
Return False
End If
End Function
Function clear()
TextBox1.Text = ""
TextBox2.Text = ""
End Function
Function empty() As Boolean
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Then
Return True
ElseIf TextBox1.Text = "" AndAlso TextBox2.Text = "" AndAlso TextBox3.Text = "" Then
Return True
Else
Return False
End If
End Function
Private Sub frm_login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MyConnection.Open()
MyCommand = New OleDbCommand("SELECT * FROM login WHERE ID ='" & TextBox1.Text & "'", MyConnection)
MyReader = MyCommand.ExecuteReader()
While MyReader.Read
TextBox3.Text = MyReader("pass")
End While
MyConnection.Close()
MyReader.Close()
MyCommand.dispose()
If verify() = True Then
MsgBox("Your log in time is " + tim, MsgBoxStyle.Information.OKOnly, "PrisLogix's PIS")
clear()
showmain()
ElseIf empty() = True Or TextBox3.Text = "" Then
MsgBox("Please fill in the fields", MsgBoxStyle.OKOnly, "PrisLogix's PIS")
ElseIf TextBox3.Text = "" And TextBox2.Text = "" Then
MsgBox("Please fill in the fields", MsgBoxStyle.OKOnly, "PrisLogix's PIS")
Else
MsgBox("Password incorrect please enter again", MsgBoxStyle.OKOnly, "PrisLogix's PIS")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
Application.Exit()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PictureBox1.Parent = Me
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
End Sub
'
'
' ' Const WM_ENDSESSION As Integer = &H16
' '
' ' Dim osexit As Boolean = False
'
' '
' ' Protected Overrides Sub WndProc(ByRef e As Message)
'
' ' If (e.Msg = WM_ENDSESSION) Then
' '
' ' osexit = True
'
' ' Application.Exit()
'' '
' ' End If
'
' MyBaseProc(e)
'' '
'
' End Sub
Private Sub Label4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
End Sub
Private Sub Label4_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label4.MouseHover
GroupBox1.Visible = True
End Sub
#End Region
#Region "GLOW CODE"
Private Sub MouseEnterEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Button1.MouseEnter, Button2.MouseEnter, Button3.MouseEnter
' A simple event handler that fires when the user's mouse arrow rolls
' over any of the buttons. It passes the button's identity to the Glow sub.
Dim ctrl As Control = CType(sender, Control)
Glow(ctrl, True)
End Sub
Private Sub MouseLeaveEvent(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Button1.MouseLeave, Button2.MouseLeave, Button3.MouseLeave
' A simple event handler that fires when the user's mouse arrow leaves the
' area of any of the buttons. It passes the button's identity to the Glow sub.
Dim ctrl As Control = CType(sender, Control)
Glow(ctrl, False)
End Sub
Private Sub Glow(ByVal ctrl As Control, ByVal Hovering As Boolean)
Dim Sb_R, Sb_G, Sb_B As Int16 ' <--- RGB values for the starting backcolor
Dim Sf_R, Sf_G, Sf_B As Int16 ' <--- RGB values for the starting forecolor
Dim Eb_R, Eb_G, Eb_B As Int16 ' <--- RGB values for the ending backcolor
Dim Ef_R, Ef_G, Ef_B As Int16 ' <--- RGB values for the ending forecolor
Select Case Hovering ' True for MouseEnter, False for MouseLeave
Case True
Sb_R = SystemColors.Control.R ' Assign the variables the
Sb_G = SystemColors.Control.G ' appropriate values based
Sb_B = SystemColors.Control.B ' on system-defined colors
' for control and control
Sf_R = SystemColors.ControlText.R ' text.
Sf_G = SystemColors.ControlText.G
Sf_B = SystemColors.ControlText.B
Eb_R = SystemColors.ActiveCaption.R ' Assign the variables the
Eb_G = SystemColors.ActiveCaption.G ' appropriate values based
Eb_B = SystemColors.ActiveCaption.B ' on system-defined colors
' for the title bar and the
Ef_R = SystemColors.ActiveCaptionText.R ' title bar's text.
Ef_G = SystemColors.ActiveCaptionText.G
Ef_B = SystemColors.ActiveCaptionText.B
Case False
Sb_R = SystemColors.ActiveCaption.R ' Assign the variables the
Sb_G = SystemColors.ActiveCaption.G ' appropriate values based
Sb_B = SystemColors.ActiveCaption.B ' on system-defined colors
' for the title bar and the
Sf_R = SystemColors.ActiveCaptionText.R ' title bar's text.
Sf_G = SystemColors.ActiveCaptionText.G
Sf_B = SystemColors.ActiveCaptionText.B
Eb_R = SystemColors.Control.R ' Assign the variables the
Eb_G = SystemColors.Control.G ' appropriate values based
Eb_B = SystemColors.Control.B ' on system-defined colors
' for control and control
Ef_R = SystemColors.ControlText.R ' text.
Ef_G = SystemColors.ControlText.G
Ef_B = SystemColors.ControlText.B
End Select
Dim b_RIncrement As Int16 = Round(((Eb_R - Sb_R) / 16), 0) ' Find the increments that
Dim b_GIncrement As Int16 = Round(((Eb_G - Sb_G) / 16), 0) ' the RGB values will take;
Dim b_BIncrement As Int16 = Round(((Eb_B - Sb_B) / 16), 0) ' 1/16th of the difference
' between the start and end
Dim f_RIncrement As Int16 = Round(((Ef_R - Sf_R) / 16), 0) ' values, rounded to the
Dim f_GIncrement As Int16 = Round(((Ef_G - Sf_G) / 16), 0) ' nearest integer.
Dim f_BIncrement As Int16 = Round(((Ef_B - Sf_B) / 16), 0)
Dim bR As Int16 = Sb_R ' \
Dim bG As Int16 = Sb_G ' }-- the RGB values for the backcolor as it changes.
Dim bB As Int16 = Sb_B ' /
Dim fR As Int16 = Sf_R ' \
Dim fG As Int16 = Sf_G ' }-- the RGB values for the forecolor as it changes.
Dim fB As Int16 = Sf_B ' /
Dim count As Int16
For count = 0 To 14
bR += b_RIncrement ' Add the appropriate increments to the
bG += b_GIncrement ' RGB values. The result is a nifty
bB += b_BIncrement ' "cross-fade" effect.
fR += f_RIncrement
fG += f_GIncrement
fB += f_BIncrement
ctrl.BackColor = Color.FromArgb(bR, bG, bB) ' Repaint the button using the
ctrl.ForeColor = Color.FromArgb(fR, fG, fB) ' current RGB values, and refresh
ctrl.Refresh() ' the button.
Threading.Thread.Sleep(30 - (count * 2)) ' Wait a certain number of milliseconds,
' which is a factor of the current count.
' I tweaked these numbers to get a decent
' effect; feel free to adjust these
' numbers to achieve an effect you like.
Next
Select Case Hovering
Case True
ctrl.BackColor = SystemColors.HighlightText ' Finish the effect by painting
ctrl.ForeColor = SystemColors.Highlight ' the control with it's final
Case False ' look, depending on whether
ctrl.BackColor = SystemColors.Highlight ' we're fading in or out.
ctrl.ForeColor = SystemColors.HighlightText
End Select
End Sub
#End Region
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -