I would use sprites myself.
// Only called when gui size or caption changes...
void GUI_Item::BuildGui () {
int old_bmp=dbCurrentBitmap();
if (dbBitmapExist(id))
dbDeleteBitmap(id);
dbCreateBitmap(id, x_size, y_size);
dbSetCurrentBitmap(id);
// now draw the control on the current bitmap
dbCLS (dbRGB (255,255,255));
dbText (10, 10, caption);
dbGetImage(id);
dbSprite(id, 0, 0, id);
dbHideSprite(id);
dbSetCurrentBitmap(old_bmp);
}
void GUI_Item::Draw () {
dbPasteSprite(id, x_pos, y_pos);
}
If you want to stick to your current approach, try
dbCopyBitmap(id,0,0,x_size,y_size,0, x_pos, y_pos, x_pos+x_size, y_pos+y_size);
Hope this helps,
JTK