resizable with buttons on top right corner

resizable with buttons on top right corner

i have a resizable box and i want to put buttons on the top right corner. as i resize the box, i want the buttons to remain always in the top right corner. how can i achieve this kind of positioning?

i'm thinking along the lines of having relative positioning which is continuously redrawn everytime the resizable is resized, but is there an easier way to do this?