📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BackColor = &H00E0E0E0&
Caption = "登录"
ClientHeight = 4305
ClientLeft = 45
ClientTop = 240
ClientWidth = 5475
LinkTopic = "Form1"
ScaleHeight = 4305
ScaleWidth = 5475
StartUpPosition = 2 '屏幕中心
Tag = "Login"
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3240
TabIndex = 7
Top = 3120
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 1080
TabIndex = 6
Top = 3120
Width = 1215
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 1455
Left = 480
Picture = "frmLogin.frx":0000
ScaleHeight = 1455
ScaleWidth = 1455
TabIndex = 5
Top = 120
Width = 1455
End
Begin VB.TextBox txtPassword
Height = 288
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 1
Top = 2400
Width = 2064
End
Begin VB.TextBox txtUserName
Height = 288
Left = 2400
TabIndex = 3
Top = 1920
Width = 2064
End
Begin VB.Label Label1
BackColor = &H00E0E0E0&
Caption = " 企业进销存 综合管理系统"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 975
Left = 2160
TabIndex = 4
Top = 480
Width = 3015
End
Begin VB.Label lblLabels
BackColor = &H00E0E0E0&
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 1080
TabIndex = 0
Tag = "&Password:"
Top = 2400
Width = 1080
End
Begin VB.Label lblLabels
BackColor = &H00E0E0E0&
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 1080
TabIndex = 2
Tag = "&User Name:"
Top = 1920
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const HTCAPTION = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Sub BForm1_CloseClick()
Unload Me
End Sub
Private Sub BForm1_DblClick()
Me.WindowState = 1
End Sub
Private Sub BForm1_MinClick()
Me.WindowState = 1
End Sub
Private Sub BForm1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
ReleaseCapture
SendMessage hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub
Private Sub Command1_Click()
If txtPassword.Text = "" Then
OK = True
Me.Hide
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
End Sub
Private Sub Command2_Click()
OK = False
Me.Hide
End Sub
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
txtUserName.Text = Left$(sBuffer, lSize)
Else
txtUserName.Text = vbNullString
End If
Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'ToDo: create test for correct password
'check for correct password
If txtPassword.Text = "" Then
OK = True
Me.Hide
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
End Sub
Private Sub ROButton1_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -