主题:[原创]密码框
弱弱的重写一次密码框,大家改改
DECLARE SUB Lable (x%, y%, caption$)
DECLARE SUB textBox (handle%, x%, y%, h%, defaultText$, passwordEnable%, maxText%)
DECLARE SUB drawBox (x%, y%, h%, w%)
DEFINT A-Z
DIM SHARED process AS INTEGER
process = 0
DIM handle AS INTEGER
CLS
CALL drawBox(6, 25, 5, 30)
CALL Lable(7, 38, "LOGIN")
LOCATE 8, 27
PRINT STRING$(28, "=")
CALL Lable(9, 27, "USER NAME:")
CALL Lable(11, 27, "PASSWORD:")
defaultText$ = "admin"
defaultText1$ = ""
DO
CALL textBox(10, 9, 38, 16, defaultText$, 0, 10)
IF process = 10 THEN END
CALL textBox(20, 11, 38, 16, defaultText1$, 1, 10)
IF process = 20 THEN END
IF process = 22 THEN EXIT DO
LOOP
CLS
COLOR 15
PRINT defaultText$
PRINT defaultText1$
END
SUB drawBox (x, y, h, w)
COLOR 9
LOCATE x, y
PRINT "+";
PRINT STRING$(w, "-");
PRINT "+"
FOR i = x + 1 TO x + h + 1
LOCATE i, y
PRINT "|"
LOCATE i, y + w + 1
PRINT "|"
NEXT i
LOCATE x + h + 1, y
PRINT "+";
PRINT STRING$(w, "-");
PRINT "+"
END SUB
SUB Lable (x, y, caption$)
COLOR 9
LOCATE x, y
PRINT caption$
END SUB
SUB textBox (handle, x, y, h, defaultText$, passwordEnable, maxText)
defaultText$ = MID$(defaultText$, 1, maxText)
charPoint = LEN(defaultText$)
COLOR 15, 7
LOCATE x, y
PRINT STRING$(h, " ")
p = y
LOCATE x, p
IF passwordEnable = 0 THEN PRINT defaultText$; ELSE PRINT STRING$(LEN(defaultText$), "*")
resultText$ = defaultText$
p = y + charPoint
DO
COLOR 31, 7
LOCATE x, p
PRINT CHR$(219);
COLOR 15, 7
DO
k$ = INKEY$
LOOP UNTIL k$ <> ""
SELECT CASE ASC(k$)
CASE 27
process = handle + 0
EXIT SUB
CASE 13
defaultText$ = resultText$
LOCATE x, p
COLOR 7
PRINT " "
process = handle + 2
EXIT SUB
CASE 9
defaultText$ = resultText$
LOCATE x, p
COLOR 15
PRINT " "
process = handle + 1
EXIT SUB
CASE 8
IF charPoint > 0 THEN
p = p - 1
LOCATE x, p
COLOR 7
PRINT " ";
COLOR 15, 7
LOCATE x, p
charPoint = charPoint - 1
resultText$ = LEFT$(resultText$, LEN(resultText$) - 1)
END IF
CASE 33 TO 126
LOCATE x, p
IF charPoint < maxText THEN
IF passwordEnable = 1 THEN
PRINT "*";
ELSE
PRINT k$;
END IF
resultText$ = resultText$ + k$
p = p + 1
charPoint = charPoint + 1
END IF
END SELECT
LOOP
END SUB
大家来我BLOG看看哦
[em1][em1] http://blog.163.com/amu.lee/
[url=http://blog.163.com/amu.lee/]阿木[/url]
DECLARE SUB Lable (x%, y%, caption$)
DECLARE SUB textBox (handle%, x%, y%, h%, defaultText$, passwordEnable%, maxText%)
DECLARE SUB drawBox (x%, y%, h%, w%)
DEFINT A-Z
DIM SHARED process AS INTEGER
process = 0
DIM handle AS INTEGER
CLS
CALL drawBox(6, 25, 5, 30)
CALL Lable(7, 38, "LOGIN")
LOCATE 8, 27
PRINT STRING$(28, "=")
CALL Lable(9, 27, "USER NAME:")
CALL Lable(11, 27, "PASSWORD:")
defaultText$ = "admin"
defaultText1$ = ""
DO
CALL textBox(10, 9, 38, 16, defaultText$, 0, 10)
IF process = 10 THEN END
CALL textBox(20, 11, 38, 16, defaultText1$, 1, 10)
IF process = 20 THEN END
IF process = 22 THEN EXIT DO
LOOP
CLS
COLOR 15
PRINT defaultText$
PRINT defaultText1$
END
SUB drawBox (x, y, h, w)
COLOR 9
LOCATE x, y
PRINT "+";
PRINT STRING$(w, "-");
PRINT "+"
FOR i = x + 1 TO x + h + 1
LOCATE i, y
PRINT "|"
LOCATE i, y + w + 1
PRINT "|"
NEXT i
LOCATE x + h + 1, y
PRINT "+";
PRINT STRING$(w, "-");
PRINT "+"
END SUB
SUB Lable (x, y, caption$)
COLOR 9
LOCATE x, y
PRINT caption$
END SUB
SUB textBox (handle, x, y, h, defaultText$, passwordEnable, maxText)
defaultText$ = MID$(defaultText$, 1, maxText)
charPoint = LEN(defaultText$)
COLOR 15, 7
LOCATE x, y
PRINT STRING$(h, " ")
p = y
LOCATE x, p
IF passwordEnable = 0 THEN PRINT defaultText$; ELSE PRINT STRING$(LEN(defaultText$), "*")
resultText$ = defaultText$
p = y + charPoint
DO
COLOR 31, 7
LOCATE x, p
PRINT CHR$(219);
COLOR 15, 7
DO
k$ = INKEY$
LOOP UNTIL k$ <> ""
SELECT CASE ASC(k$)
CASE 27
process = handle + 0
EXIT SUB
CASE 13
defaultText$ = resultText$
LOCATE x, p
COLOR 7
PRINT " "
process = handle + 2
EXIT SUB
CASE 9
defaultText$ = resultText$
LOCATE x, p
COLOR 15
PRINT " "
process = handle + 1
EXIT SUB
CASE 8
IF charPoint > 0 THEN
p = p - 1
LOCATE x, p
COLOR 7
PRINT " ";
COLOR 15, 7
LOCATE x, p
charPoint = charPoint - 1
resultText$ = LEFT$(resultText$, LEN(resultText$) - 1)
END IF
CASE 33 TO 126
LOCATE x, p
IF charPoint < maxText THEN
IF passwordEnable = 1 THEN
PRINT "*";
ELSE
PRINT k$;
END IF
resultText$ = resultText$ + k$
p = p + 1
charPoint = charPoint + 1
END IF
END SELECT
LOOP
END SUB
大家来我BLOG看看哦
[em1][em1] http://blog.163.com/amu.lee/
[url=http://blog.163.com/amu.lee/]阿木[/url]