回复 30楼 TonyDeng
好吧,就这样了吧。非常感谢你!谢谢!
CLEAR ALL Main() RETURN PROCEDURE Main LOCAL loForm loForm = CREATEOBJECT("_Form") WITH loForm .Caption = "抽奖" .AutoCenter = .T. .Show ENDWITH READ EVENTS ENDPROC DEFINE CLASS _Form AS Form IsRolling = .F. ADD OBJECT Command1 AS CommandButton WITH Height = 25, Width = 40 ADD OBJECT Text1 AS TextBox WITH Height = 25, Width = 100, Enabled = .F. PROCEDURE Load USE 表1 ALIAS students IN 0 ENDPROC PROCEDURE Unload IF USED("students") USE IN students ENDIF ENDPROC PROCEDURE Arrange WITH This.Text1 .Top = 5 .Left = 5 ENDWITH WITH Top = This.Text1.Top .Left = This.Text1.Left + This.Text1.Width + 5 ENDWITH ENDPROC PROCEDURE Activate This.Arrange ENDPROC PROCEDURE Resize This.Arrange ENDPROC PROCEDURE Destroy CLEAR EVENTS ENDPROC PROCEDURE Text1.Roll DO WHILE ThisForm.IsRolling IF INKEY(0.2, "M") == 0 This.Value = ALLTRIM(students.姓名) SELECT students SKIP IF EOF() GOTO TOP ENDIF ELSE LOCAL laObjs[1] IF (AMOUSEOBJ(laObjs) > 0) .AND. (UPPER(laObjs[1].Name) == UPPER()) ThisForm.IsRolling = .F. EXIT ENDIF ENDIF ENDDO ENDPROC PROCEDURE Command1.Refresh This.Caption = IIF(!ThisForm.IsRolling, "开始", "结束") ENDPROC PROCEDURE Command1.Click ThisForm.IsRolling = !ThisForm.IsRolling This.Refresh IF ThisForm.IsRolling ThisForm.Text1.Roll ENDIF ENDPROC ENDDEFINE