Displaying multi-page tiff files using the ImageBox control and C#
A brief article showing how to display individual pages from a multi-page tiff file in the ImageBox control.
ImageBox control has had quite a big update, you can
download the source from the link below, or from our GitHub
Listed below are the changes made during this update, we hope you enjoy them!
ZoomLevelsproperty which allows you to configure the different zoom levels supported by the control. Now instead of the control trying to guess the next zoom level, it cycles appropriately through the defined levels. Currently ZoomLevels (apart from the default series) can only be set at runtime.
ZoomIncrementproperty has been removed due to the introduction of the new zoom levels.
ScrollTomethods allow you to scroll to a given location in the source image.
ProcessScrollingShortcutsfor handling arrow keys and
ProcessImageShortcutsfor handling pretty much anything else.
EnableShortcutsproperty, allowing the built in keyboard support to be disabled. When this property is true,
ProcessImageShortcutsis not called, allowing the control to still be scrolled via the keyboard, but not zoomed etc.
AutoCenterproperty is set, the control will always center the image even when scrollbars are present.
EndUpdatemethods allow you to disable and enable painting of the control, for example when changing multiple properties at once.
GetSelectedImagemethod which creates a new
Bitmapbased on the current selection.
FitRectanglemethod which takes a given rectangle and ensure it fits within the image boundaries
AllowClickZoomproperty now defaults to
PointToImagefunction no longer adds +1 to the result of the function.
ZoomToRegionmethod. This will caculate and appropriate zoom level and scrollbar positions to fit a given rectangle.
SelectionMode.Zoom. When this mode is selected, drawing a region will automatically zoom and position the control to fit the region, after which the region is automatically cleared.
VirtualScrollableControlis now used instead of
ScrollableControl. This removes completely the flicker issues present in previous versions of the control.
ScrollControlclass, so that borders now correctly surround the control (including scrollbars) rather than just the client area.
true, the control no longer magically zooms after panning or selecting a region. Code previously in the
OnMouseClickoverride is now in
AutoPanand a valid
SelectionModeare set, only selections are processed, instead of the control tying to do both. As a result of this fix, setting the
SelectionModeproperty no longer resets
MouseWheelevent is now raised as expected.
ScrollPropertiesclass hasn't been fully integrated with the
ScrollControl, setting properties on this class won't update the owner control.
Like what you're reading? Perhaps you like to buy us a coffee?