; CopyRect Example ; ---------------- Graphics 640,480,0,2 SetBuffer BackBuffer() SeedRnd MilliSecs() ; Bouncing bubbles give the monitor panel something to watch Dim bx#(9),by#(9),bvx#(9),bvy#(9) For i=0 To 9 bx(i)=Rnd(40,560) by(i)=Rnd(80,400) bvx(i)=Rnd(1,3) bvy(i)=Rnd(1,3) Next While Not KeyDown(1) Cls ; Move and draw the bubbles For i=0 To 9 bx(i)=bx(i)+bvx(i) by(i)=by(i)+bvy(i) If bx(i)<0 Or bx(i)>600 Then bvx(i)=-bvx(i) If by(i)<40 Or by(i)>440 Then bvy(i)=-bvy(i) Color 50+i*20,150,255-i*20 Oval bx(i),by(i),40,40,1 Next ; A 160x120 source window follows the mouse (kept on screen) sx=MouseX()-80 sy=MouseY()-60 If sx<0 Then sx=0 If sx>480 Then sx=480 If sy<0 Then sy=0 If sy>360 Then sy=360 ; CopyRect duplicates that region into the top-right monitor panel CopyRect sx,sy,160,120,470,30,BackBuffer(),BackBuffer() ; Frame the source window and the monitor panel Color 255,255,0 Rect sx,sy,160,120,0 Color 255,255,255 Rect 469,29,162,122,0 Text 0,0,"Move the mouse - CopyRect mirrors the yellow window top-right Esc: exit" Text 0,20,"CopyRect "+sx+","+sy+",160,120,470,30,BackBuffer(),BackBuffer()" Flip Wend End