RubberBand Zooming with PixTools

Sometimes it’s useful to have a zone on an image, indicating an area where some sort of image processing is to occur.  For example, in the following image, the yellow zone indicates a barcode area of interest:




To create a region, a PixRegion is created and associated to a PixView using a RegionsInputHandler:


PixRegion region;
RegionsInputHandler handler;
handler = new RegionsInputHandler();
handler.RequiredModifiers = Keys.LButton;
handler.AllowCreate = false;
handler.AllowMove = true;
handler.AllowResize = true;
region = handler.Create(new Rectangle(0, 0, 300, 300));


In this case, the Mouse Left key controls the dragging and resizing of the PixRegion.  After the size of the zoomed rectangle is determined, PixView contains a function called "ZoomTo" that allows zooming focus based on a rectangle.