📄 frm_login.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_login
BackColor = &H8000000A&
BorderStyle = 0 'None
Caption = "系统登录"
ClientHeight = 3855
ClientLeft = 0
ClientTop = 0
ClientWidth = 5880
Icon = "frm_login.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frm_login.frx":164A
ScaleHeight = 3855
ScaleWidth = 5880
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 645
Top = 3360
Visible = 0 'False
Width = 1875
_ExtentX = 3307
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox txtPassword
BackColor = &H00FFFFFF&
BorderStyle = 0 'None
Height = 210
IMEMode = 3 'DISABLE
Left = 3180
PasswordChar = "*"
TabIndex = 1
Top = 2250
Width = 1770
End
Begin VB.TextBox txtName
BackColor = &H00FFFFFF&
BorderStyle = 0 'None
Height = 210
Left = 3180
TabIndex = 0
Top = 1860
Width = 1770
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Height = 300
Left = 3945
TabIndex = 3
Top = 2745
Width = 990
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Height = 285
Left = 2850
TabIndex = 2
Top = 2760
Width = 1005
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "登 录"
ForeColor = &H00C00000&
Height = 180
Left = 3135
TabIndex = 4
Top = 2835
Width = 450
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "取 消"
ForeColor = &H00C00000&
Height = 180
Left = 4245
TabIndex = 5
Top = 2835
Width = 450
End
End
Attribute VB_Name = "frm_login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim txtRS As String
Private Sub Form_Load()
Adodc1.ConnectionString = PublicStr
Adodc1.RecordSource = "select * from tbS_power"
Adodc1.Refresh
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Label3.ForeColor = &H80000012
Label4.ForeColor = &H80000012
End Sub
Private Sub Label1_Click()
Adodc1.RecordSource = "select * from tbS_power"
Adodc1.Refresh
On Error Resume Next
txtRS = Adodc1.Recordset.Fields(0)
If txtRS = "" Then '首先判断该系统是否有用户
MsgBox "尊敬的用户,你还没有注册为本系统用户,请尽快注册为系统用户"
frm_main.Show '窗体的 Show方法 显示指定的窗体
frm_setOP.Show '窗体的 Show方法 显示指定的窗体
frm_main.Enabled = False
Unload Me
Exit Sub
End If
Adodc1.RecordSource = "select * from tbS_power where sysuser='" + txtName.Text + "'and password='" + txtPassword.Text + "'"
Adodc1.Refresh
'管理员最高权限
If Adodc1.Recordset.Fields(2).Value = 0 Or Adodc1.Recordset.Fields(3).Value = 0 Or Adodc1.Recordset.Fields(4).Value = 0 Or Adodc1.Recordset.Fields(5).Value = 0 Or Adodc1.Recordset.Fields(6).Value = 0 Then
Else
frm_main.Show '窗体的 Show方法 显示指定的窗体
Unload Me
Exit Sub
End If
'为用户分配权限
If Adodc1.Recordset.RecordCount > 0 Then
If Adodc1.Recordset.Fields(2).Value Then '进货管理
frm_main.file1.Enabled = True
frm_main.labFile(0).Enabled = True
Else
frm_main.file1.Enabled = False
frm_main.labFile(0).Enabled = False
End If
If Adodc1.Recordset.Fields(3).Value Then '销售管理
frm_main.file2.Enabled = True
frm_main.labFile(1).Enabled = True
Else
frm_main.file2.Enabled = False
frm_main.labFile(1).Enabled = False
End If
If Adodc1.Recordset.Fields(4).Value Then '库存管理
frm_main.file3.Enabled = True
frm_main.labFile(2).Enabled = True
Else
frm_main.file3.Enabled = False
frm_main.labFile(2).Enabled = False
End If
If Adodc1.Recordset.Fields("system").Value Then '系统管理
frm_main.file6.Enabled = True
frm_main.labFile(3).Enabled = True
Else
frm_main.file6.Enabled = False
frm_main.labFile(3).Enabled = False
End If
If Adodc1.Recordset.Fields("base").Value Then
frm_main.file5.Enabled = True
Else
frm_main.file5.Enabled = False
End If
frm_main.Show '窗体的 Show方法 显示指定的窗体
Unload Me
Else
MsgBox "您输入的信息不正确!"
txtName.SetFocus '使控件获得焦点
Exit Sub
End If
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Label3.ForeColor = &HC00000
End Sub
Private Sub Label2_Click()
Unload Me
End Sub
Private Sub Label2_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)
Label4.ForeColor = &HC00000
End Sub
Private Sub txtName_DblClick()
Dim ReturnValue
ReturnValue = Shell("osk.EXE", 1) '启动系统软键盘
AppActivate ReturnValue
End Sub
Private Sub txtName_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then SendKeys "{TAB}"
End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call Label1_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -