I need to select a rectangular area on the picture with the mouse, the area is translucent so that it is different from the non-selected area. In addition, the size of the selected area can be adjusted by dragging the border with the mouse.

Is there any good way to achieve this function? Any advice and suggestions would be greatly appreciated.