Overview
In a windows forms application it may be useful to automatically resize the image viewer area to that of the image you are attaching. This means that you do not have to statically layout your image viewer control in development and can modify the size of the control at run time. The image viewer will by default allow a user to pan through the image, but this may not be as useful as the ability to view the entire image.
Description
This code allows a user to read in an image using the open file dialog browser. The user can select any color image available and the program will automatically resize the ImageViewer to display the entire image in the form.
Steps to Implement or Execute Code
Requirements
Software
Visual Studio 2012
NI Vision
NI Vision Acquisition Software
Hardware
N/A
Additional Images or Video
The code used to modify the image viewer size is the ImageViewer.Size property, which is set to the same size that we can get from the Image we read in.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.