c# - Make selection frame follow picturebox after resize -


i have 2 pictureboxes, 1 on another. 1 serves selection frame, - picture holder. , problem: when try resize main form of program, recalculates , resizes picture in main picturebox, cant understand how make second 1 follow it's prev. position.

thats have, called in form1_resizeend:

  picturebox3.left += this.width - windowwidth;   picturebox3.top += this.height - windowheight; 

windowwidth , windowheight - previous window dimensions.

it works, problems - picturebox mode centered, means picture moves differently, , +5 form width not mean +5 picture's left.

and while writing question found answer myself. here is:

picturebox3.left += (this.width - windowwidth)/2; picturebox3.top += (this.height - windowheight)/2; 

Comments