mouse move

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
program test;
uses graphabc;
var x1,y1,x2,y2:integer;
check:boolean;
procedure MouseDown(x,y,mb:integer);
begin
if check=false then begin
x2:=x;y2:=y;
x1:=x;y1:=y;check:=true;
end
else begin
x2:=x;y2:=y;check:=false;
end;
end;
procedure MouseMove(x,y,mb: integer);
begin
if check=true then begin
x2:=x;y2:=y;
end;
end;
procedure MouseUp(x,y,mb: integer);
begin
check:=false;
end;
begin
check:=false;x1:=0;x2:=0;y1:=0;y2:=0;
while 0=0 do begin
OnMouseDown := MouseDown;
OnMouseUp := MouseUp;
LockDrawing;
window.Clear();
rectangle(x1,y1,x2,y2);
Redraw;
OnMouseMove := MouseMove;
end;
end.