程序代码:
SET TALK OFF
PUBLIC glLogin AS Boolean
glLogin = .F.
PUBLIC glSuccess AS Boolean
glSuccess = .F.
Form1 = CREATEOBJECT("C_Form1")
Form1.Show
READ EVENTS
RETURN
DEFINE CLASS C_Form1 AS Form
Caption = "Form1"
ShowWindow = 2
Width = 600
Height = 400
AutoCenter = .T.
ADD OBJECT Command1 AS CommandButton WITH Caption = "录入", Height = 25, Width = 60, Top = 20, Left = 20, Enabled = .F.
ADD OBJECT Command2 AS CommandButton WITH Caption = "借出", Height = 25, Width = 60, Top = 50, Left = 20, Enabled = .F.
ADD OBJECT Command3 AS CommandButton WITH Caption = "还回", Height = 25, Width = 60, Top = 80, Left = 20, Enabled = .F.
ADD OBJECT Command4 AS CommandButton WITH Caption = "查阅", Height = 25, Width = 60, Top = 120, Left = 20, Enabled = .F.
ADD OBJECT Command5 AS CommandButton WITH Caption = "关闭", Height = 25, Width = 60, Top = 360, Left = 20
PROCEDURE Activate
IF !glLogin
glLogin = .T.
LOCAL frm_Login AS Object
frm_Login = CREATEOBJECT("C_Login")
frm_Login.Show
IF glSuccess
ThisForm.SetAll("Enabled", .T., "CommandButton")
ENDIF
ENDIF
ENDPROC
PROCEDURE Destroy
CLEAR EVENTS
ENDPROC
PROCEDURE Command5.Click
RELEASE ThisForm
ENDPROC
ENDDEFINE
DEFINE CLASS C_Login AS Form
Caption = "登录界面"
ShowWindow = 1
WindowType = 1
Width = 300
Height = 120
ControlBox = .F.
AutoCenter = .T.
ADD OBJECT Label1 AS Label WITH Caption = "请输入用户名: ", Alignment = 1, Height = 25, Width = 100, Top = 20, Left = 20
ADD OBJECT Text1 AS TextBox WITH Value = "", Height = 25, Width = 150, Top = 20, Left = 120
ADD OBJECT Label2 AS Label WITH Caption = "请输入密码口令: ", Alignment = 1, Height = 25, Width = 100, Top = 50, Left = 20
ADD OBJECT Text2 AS TextBox WITH Value = "", PasswordChar = "*", Height = 25, Width = 150, Top = 50, Left = 120
ADD OBJECT Command1 AS CommandButton WITH Caption = "确定登录", Height = 25, Width = 60, Top = 80, Left = 60
ADD OBJECT Command2 AS CommandButton WITH Caption = "关闭退出", Height = 25, Width = 60, Top = 80, Left = 130
PROCEDURE Command1.Click
glSuccess = (ALLTRIM(ThisForm.Text2.Value) == "Admin")
RELEASE ThisForm
ENDPROC
PROCEDURE Command2.Click
RELEASE ThisForm
ENDPROC
ENDDEFINE
[
本帖最后由 TonyDeng 于 2011-8-13 12:38 编辑 ]