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.
The ImageBox
control has had quite a big update, you can
download the source from the link below, or from our GitHub
page.
Listed below are the changes made during this update, we hope you enjoy them!
ZoomLevels
property 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.ZoomIncrement
property has been removed due to the
introduction of the new zoom levels.CenterAt
and ScrollTo
methods allow you to scroll to a
given location in the source image.ProcessScrollingShortcuts
for handling arrow keys and
ProcessImageShortcuts
for handling pretty much anything
else.EnableShortcuts
property, allowing the built in
keyboard support to be disabled. When this property is true,
ProcessImageShortcuts
is not called, allowing the control to
still be scrolled via the keyboard, but not zoomed etc.OemMinus
and
Oemplus
).AutoCenter
property is set, the control will always center the image even
when scrollbars are present.BeginUpdate
and EndUpdate
methods allow you to
disable and enable painting of the control, for example when
changing multiple properties at once.GetSelectedImage
method which creates a new
Bitmap
based on the current selection.FitRectangle
method which takes a given rectangle
and ensure it fits within the image boundariesAllowClickZoom
property now defaults to false
.PointToImage
function no longer adds +1 to the result of
the function.ZoomToRegion
method. 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.VirtualScrollableControl
is now used
instead of ScrollableControl
. This removes completely the
flicker issues present in previous versions of the control.ScrollControl
class, so that borders now correctly surround the control
(including scrollbars) rather than just the client area.AllowZoomClick
property is true
, the control no
longer magically zooms after panning or selecting a region.
Code previously in the OnMouseClick
override is now in
OnMouseUp
.AutoPan
and a valid SelectionMode
are set, only
selections are processed, instead of the control tying to do
both. As a result of this fix, setting the SelectionMode
property no longer resets AutoPan
VirtualScrollableControl
, the
MouseWheel
event is now raised as expected.ScrollProperties
class 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?
# TeYoU
# Richard Moss
# WMJ
# Richard Moss
# Fajar
# Richard Moss
# Tim Miltz
# Richard Moss
# Jim
# Richard Moss
# Carlos Fernando Castaneda Olano
# ignacio
# ignacio
# Richard Moss