In This Topic
ImageViewer is a WinForms control, designed to display collection of images.
ImageViewer can work separately and in this case
ImageViewer can work as a "slave viewer" of another
ImageViewer or
ThumbnailViewer and in this case
- link between viewers can be set using the ImageViewerBase.MasterViewer property of the slave viewer
- slave viewer uses image collection of the master viewer
- shared image collection can be accessed using the ImageViewerBase.Images property of master or slave viewer
- image collection can be navigated using the ImageViewerBase.FocusedIndex property of master or slave viewer
- ImageViewerBase.FocusedIndex properties of master and slave viewer are changed synchronously
- image is added/updated/removed in image viewer if image is added/updated/removed from associatedimage collection
Here is C#/VB.NET code that shows how to load images to
ImageViewer and select the last image for displaying:
imageViewer1.Images.Add("myimages.tif");
imageViewer1.FocusedIndex = imageViewer1.Images.Count - 1;
imageViewer1.Images.Add("myimages.tif")
imageViewer1.FocusedIndex = imageViewer1.Images.Count - 1
Preview of images
Image viewer display mode
ImageViewer can display one or several images simulateously.
The
ImageViewer.DisplayMode property allows to set one of the predefined display modes:
-
Single page - the image viewer simultaneously displays 1 image.
-
Single column - the image viewer simultaneously displays 1 image in 1 column.
-
Single row - the image viewer simultaneously displays 1 image in 1 row.
-
Single continuous column - the image viewer simultaneously displays all images in 1 continuous column.
-
Single continuous row - the image viewer simultaneously displays all images in 1 continuous row.
-
Two columns - the image viewer simultaneously displays 2 images in 2 columns.
-
Two rows - the image viewer simultaneously displays 2 images in 2 rows.
-
Two continuous columns - the image viewer simultaneously displays all images in 2 continuous columns.
-
Two continuous rows - the image viewer simultaneously displays all images in 2 continuous rows.
-
Three columns - the image viewer simultaneously displays 3 images in 3 columns.
-
Three rows - the image viewer simultaneously displays 3 images in 3 rows.
-
Three continuous columns - the image viewer simultaneously displays all images in 3 continuous columns.
-
Three continuous rows - the image viewer simultaneously displays all images in 3 continuous rows.
Also
ImageViewer allows to define the custom image display mode using the following properties:
Image preview modes
ImageViewer can preview image in different modes.
The
ImageViewer.SizeMode property allows to set one of the predefined preview modes:
- Normal - previews image using image resolution without scaling
- PixelToPixel - previews image using the screen resolution without scaling, image resolution will be ignored
- FitToWidth - scales the image to fit the width of control
- FitToHeight - scales the image to fit the height of control
- BestFit - scales the image proportion to the control
- Zoom - zooms the image to the specified value
Image appearance
ImageViewer allows to specify the appearance (background brush, background color, border color, border width, border style) for focused image using the
ImageViewer.FocusedImageAppearance property and for not focused images using the
ImageViewer.ImageAppearance property.
Rendering quality
ImageViewer allows to specify image rendering quality.
Here, for comparison, is the same image rendered with low and high quality:
Rendering quality can be changed with the
ImageViewer.RenderingQuality property.
Rendering settings
Vector images/documents, for example PDF, DOCX or XLSX documents, must be rendered before preview in the
ImageViewer.
Rendering settings for vector images/documents can be set with the
ImageViewer.ImageRenderingSettings property.
Manipulation of images
Hot keys
ImageViewer has hot keys:
- Ctrl+C - copies current image to clipboard
- Ctrl+X - copies current image to clipboard and removes image from associated image collection
- Ctrl+V - inserts image from clipboard as current image
- Del - deletes current image from associated image collection
Hot keys can be enabled/disabled with the
ImageViewerBase.ShortcutCopy,
ImageViewerBase.ShortcutCut,
ImageViewerBase.ShortcutInsert,
ImageViewerBase.ShortcutDelete properties.
Behaviour of hot keys can be overriden with the
ImageViewerBase.DoCopy,
ImageViewerBase.DoCut,
ImageViewerBase.DoInsert,
ImageViewerBase.DoDelete methods.
Context menu of image viewer
ImageViewer has context menu which can accessed with the ContextMenuStrip property.
Visual tools
The visual tools extend functionality of
ImageViewer class and allow to process images interactively. Information about available visual tools can be found
here.
Active visual tool of the
ImageViewer can be set using the
ImageViewer.VisualTool property.