Demo using the Zoom function of csXImage in C#

This demo application uses two instances of the csXImage control on a single C# form. An image file can be loaded into the right-hand control (axImageBox2) by using the "Load File" command button. This image is automatically duplicated in the left-hand control (axImageBox1).

Two other command buttons are provided, for "Zoom In" and "Zoom Out". The code executed by these buttons will increase or decrease the value of the Zoom property by 10% each time. axImageBox2 will be zoomed in or out.

The image in ImageBox1 is automatically updated either when axImageBox2 is zoomed, or scrolled. Scrolling is detected by using the OnScroll event. The coordinates of a rectangle that represent the visible part of the image in axImageBox2 are calculated and this rectangle is drawn on ImageBox1 and highlighted by adjusting the brightness of this section of the image.

Image zoom in C#

To run this demo you need the csXImage trial ocx control installed on your system as well as MS Visual Studio.NET. The trial control and the example files are available below:

Download the trial csXImage control - csXImageTrial.exe (3 MB)

The demo C# project - ZoomDemoCSharp.zip (186 KB)

Description and listing of the project code.