version 5.00 0 Form1 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 238 268 1 ImageLib.dll 1 ImageLib.dll 6 drawer:Drawer erasebrush:Brush rectsrc:Rectangle rectdest:Rectangle rectdest2:Rectangle bmp:Bitmap Sub designer addform(Form1,"Form1","bg.jpg",220,220,220)@ addtimer(form1,Timer1,95,215,20)@ End Sub @EndOfDesignText@ Sub Globals Dim Type(X,Y) speed(2) speed(0).X = 1 speed(0).Y = 1 speed(1).X = -1 speed(1).Y = -1 End Sub Sub App_Start Form1.Show bmp.New1(AppPath & "\smiley.gif") transparentColor = bmp.GetPixel1(0,0) SetTransparentColor(transparentColor) 'drawing with this color will erase the forelayer. eraseBrush.New1(transparentColor) 'Create a brush that will use to erase the previous image. Form1.ForeLayer = true drawer.New1("Form1",true) drawer.SetTransparentColor1(transparentColor) rectSrc.New1(0,0,bmp.Width,bmp.Height) 'The source rectangle. rectDest.New1(120,120,30,30) 'The target rectangle. rectDest2.New1(120,120,40,40) drawer.DrawImage1(bmp.Value,rectSrc.Value,rectDest.Value,true) drawer.DrawImage1(bmp.Value,rectSrc.Value,rectDest2.Value,true) Form1.DrawString("Try to catch the smiley",12,10,10,200,50,cBlack) Timer1.Enabled = true End Sub Sub Timer1_Tick if rectDest.X >= Form1.Width - 5 OR rectDest.X <=0 then speed(0).X = -speed(0).X if rectDest.Y >= Form1.Height - 5 OR rectDest.Y <=0 then speed(0).Y = -speed(0).Y if rectDest2.X >= Form1.Width - 5 OR rectDest2.X <=0 then speed(1).X = -speed(1).X if rectDest2.Y >= Form1.Height - 5 OR rectDest2.Y <=0 then speed(1).Y = -speed(1).Y drawer.FillRectangle(eraseBrush.Value,rectDest.Value) 'Erase the previous image. drawer.FillRectangle(eraseBrush.Value,rectDest2.Value) 'Erase the previous image. drawer.Refresh2(rectDest.Value) drawer.Refresh2(rectDest2.Value) rectDest.X = rectDest.X + speed(0).X rectDest.Y = rectDest.Y + speed(0).Y rectDest2.X = rectDest2.X + speed(1).X rectDest2.Y = rectDest2.Y + speed(1).Y drawer.DrawImage1(bmp.Value,rectSrc.Value,rectDest.Value,true) 'Draw the new image. drawer.DrawImage1(bmp.Value,rectSrc.Value,rectDest2.Value,true) 'Draw the new image. drawer.Refresh2(rectDest.Value) drawer.Refresh2(rectDest2.Value) End Sub Sub Form1_MouseDown (x,y) if x >= rectDest.X AND x <=rectDest.X + rectDest.Width AND y >= rectDest.Y AND y <= rectDest.Y + rectDest.Height then speed(0).X = -speed(0).X speed(0).Y = -speed(0).Y else if x>= rectDest2.X AND x <=rectDest2.X + rectDest2.Width AND y >= rectDest2.Y AND y <= rectDest2.Y + rectDest2.Height then speed(1).X = -speed(1).X speed(1).Y = -speed(1).Y end if End Sub