【水】【We&MC工作室】【示例】Create单元讲解
pascal吧
全部回复
仅看楼主
level 7
Marco690 楼主
提醒:请勿插楼,负责给予删帖处理
本帖主要为讲解Create单元的函数、过程,欢迎各位牛、牪、犇在2L回复指点。
2015年02月27日 03点02分 1
level 7
Marco690 楼主
2L回复
2015年02月27日 03点02分 2
level 7
Marco690 楼主
3L为不想看的人的懒人链接
2015年02月27日 03点02分 3
通用连接:Marco690.ys168.com
2015年02月27日 03点02分
百度网盘链接:yun.baidu.com/share/link?shareid=414565171&uk=1312753881
2015年02月27日 03点02分
@Marco690 能不用永硕吗?度盘可以吗?
2015年02月27日 04点02分
@圣羊头人八嘎 都可以的
2015年02月27日 04点02分
level 7
Marco690 楼主
No.1 过程Title
代码:
procedure Title(name:string);
begin
exec('cmd','/c title '+name);
end;
作用:设置标题为Name
截图:
2015年02月27日 03点02分 4
灰常好[哈哈]
2015年02月27日 04点02分
level 7
Marco690 楼主
No.2 过程Move
代码:
procedure Move(x,y:word);
begin
gotoxy(y,x);
end;
作用:将光标移动到X行Y列
截图:
2015年02月27日 04点02分 5
level 7
Marco690 楼主
No.3 过程CoolWrite
代码1:
procedure CoolWrite(x,y:word;str:string);
var
i:longint;
begin
gotoxy(y,x);
for i:=1 to length(str) do
begin
write(str[i]);
delay(100);
end;
for i:=length(str) downto 1 do
begin
gotoxy(y+i-1,x);
write(' ');
gotoxy(y+i-1,x);
delay(100);
end;
end;
代码2:
procedure CoolWrite(x,y:integer;str:string);
var
i:longint;
begin
gotoxy(y,x);
for i:=1 to length(str) do
begin
write(str[i]);
delay(100);
end;
for i:=length(str) downto 1 do
begin
gotoxy(y+i-1,x);
write(' ');
gotoxy(y+i-1,x);
delay(100);
end;
end;
代码3:
procedure CoolWrite(x,y:longint;str:string);
var
i:longint;
begin
gotoxy(y,x);
for i:=1 to length(str) do
begin
write(str[i]);
delay(100);
end;
for i:=length(str) downto 1 do
begin
gotoxy(y+i-1,x);
write(' ');
gotoxy(y+i-1,x);
delay(100);
end;
end;
截图:
2015年02月27日 04点02分 6
level 7
Marco690 楼主
No.4 过程Clear
代码:
procedure Clear;
begin
clrscr;
end;
作用:清屏,同Clrscr
截图:
2015年02月27日 04点02分 7
level 7
Marco690 楼主
No.5 过程PaintBar
代码1:
procedure PaintBar(x,y:longint;color:word);
var
xc,yc,i,j:longint;
begin
xc:=wherey;
yc:=wherex;
textbackground(color);
for i:=1 to x do
begin
for j:=1 to y do
begin
gotoxy(yc+j-1,xc+i-1);
write(' ');
end;
end;
textbackground(0);
end;
代码2:
procedure PaintBar(x,y:integer;color:word);
var
xc,yc,i,j:longint;
begin
xc:=wherey;
yc:=wherex;
textbackground(color);
for i:=1 to x do
begin
for j:=1 to y do
begin
gotoxy(yc+j-1,xc+i-1);
write(' ');
end;
end;
textbackground(0);
end;
代码3:
procedure PaintBar(x,y:word;color:word);
var
xc,yc,i,j:longint;
begin
xc:=wherey;
yc:=wherex;
textbackground(color);
for i:=1 to x do
begin
for j:=1 to y do
begin
gotoxy(yc+j-1,xc+i-1);
write(' ');
end;
end;
textbackground(0);
end;
作用:在屏幕上输出一个X行Y列颜色为COLOR的长方形(正方形)
截图:
2015年02月27日 04点02分 9
level 7
Marco690 楼主
No.6 过程CurOff
代码:
procedure CurOff;
begin
cursoroff;
end;
作用:隐藏光标,同Cursoroff
截图:
2015年02月27日 04点02分 10
禁止水贴
2015年02月27日 04点02分
@Marco690 我当然知道差不多
2015年02月27日 04点02分
level 7
Marco690 楼主
No.7 函数Password
代码:
function password:string;
var
pass:char;
str:string;
x,y:longint;
function judge:boolean;
begin
judge:=not((ord(pass)=13) or (pass=#28));
end;
begin
str:='';
write('Password:');
x:=wherey;
y:=wherex;
while judge do
begin
pass:=readkey;
if (ord(pass)=8) and (str<>'') then
begin
delete(str,length(str),1);
dec(y);
gotoxy(y,x);
write(' ');
gotoxy(y,x);
end else
begin
if (judge) and (ord(pass)<>8) then
begin
str:=str+pass;
write('*');
inc(y);
end;
end;
end;
password:=str;
writeln;
end;
作用:取得用户在屏幕上输入的密码
截图:
2015年02月27日 04点02分 11
level 7
Marco690 楼主
No.8 函数Password
代码:
function password(ch:char):string;
var
pass:char;
str:string;
x,y:longint;
function judge:boolean;
begin
judge:=not((ord(pass)=13) or (pass=#28));
end;
begin
str:='';
write('Password:');
x:=wherey;
y:=wherex;
while judge do
begin
pass:=readkey;
if (ord(pass)=8) and (str<>'') then
begin
delete(str,length(str),1);
dec(y);
gotoxy(y,x);
write(' ');
gotoxy(y,x);
end else
begin
if (judge) and (ord(pass)<>8) then
begin
str:=str+pass;
write(ch);
inc(y);
end;
end;
end;
password:=str;
writeln;
end;
作用:取得用户在屏幕上输入的密码,用CH作替换字符
截图:
2015年02月28日 01点02分 12
level 7
Marco690 楼主
No.9 函数ReadChar
代码:
function ReadChar:char;
begin
exit(readkey);
end;
作用:取得用户在键盘上按下的键,同Readkey
截图:
2015年02月28日 01点02分 13
level 7
Marco690 楼主
No.10 函数GetRandom
代码1:
function Getrandom(min,max:longint):longint;
begin
randomize;
Getrandom:=random(max-min)+min;
end;
代码2:
function Getrandom(min,max:integer):longint;
begin
randomize;
Getrandom:=random(max-min)+min;
end;
代码3:
function Getrandom(min,max:word):longint;
begin
randomize;
Getrandom:=random(max-min)+min;
end;
截图:
2015年02月28日 01点02分 14
level 7
Marco690 楼主
No.11 函数Keypress
代码:
function Keypress:boolean;
begin
Keypress:=keypressed;
end;
作用:判断用户是否按下了键盘,同Keypressed
截图:
2015年02月28日 01点02分 15
level 7
Marco690 楼主
-------------------------------------------End------------------------------------------
-----------------------------我是萌萌(≥▽≤)的分界线----------------------------
2015年02月28日 01点02分 16
1