if nButton = 1 this.width = max(nxCoord-this.left,1) this.height = max(nyCoord-this.top,1) *If this is a container * This.Shape1.height = this.height - 2 * This.Shape1.width = this.width - 2 * This.Shape1.top = 1 * This.Shape1.left = 1 endifOf course this one assumes you start mousedown at the lower left corner. You should extend the code to check where it started and act upon it.