I think I've done it my self.
Here is the code if s.o needs it
bool IsInMouseArea(unsigned short XStart,unsigned short YStart,unsigned short XEnd,unsigned short YEnd,unsigned short& MouseX,unsigned short& MouseY)
{
if (dbMouseClick()== 1 && dbMouseX()>= XStart && dbMouseY()>= YStart && dbMouseX()<=XEnd && dbMouseY()<=YEnd)
{
MouseX = dbMouseX() - XStart;
MouseY = dbMouseY() - YStart;
return true;
}
else
return false;
}
unsigned short MouseX,MouseY;
if( IsInMouseArea(dbSpriteX(i),dbSpriteY(i),dbSpriteX(i) + dbSpriteWidth (i) ,dbSpriteY(i) + dbSpriteHeight (i),MouseX,MouseY ))
while (dbMouseClick()== 1)
{
if (i <= 16)
dbSprite (i,dbMouseX () - MouseX ,dbMouseY () - MouseY ,2);
else
dbSprite (i,dbMouseX () - MouseX ,dbMouseY () - MouseY ,3);
dbSync ( );
}