I am planning to write a VB Graphics application. I want it to be possible to click and drag over the graphic to produce a rectangle.

I have seen many commercial applications which produce a rectangle around a text area, or part of a graphic, in order to indicate what is to be moved or zoomed in on.

If possible, I do not want to reinvent this wheel. Besides, maybe I could not reinvent it.

I do not need code, just some hints.

I am particularly wondering about how to quickly erase rectangles as the click and drag is being done. I assume that you must save the pixels overlaid by the lines and then redraw them, but do not know how to do this.