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.
Today we've released a new updated version of the
control, with a nice collection of enhancements and a few bug
Full change log for this update:
ImageBoxcontrol is licensed under the MIT license, allowing you free reign to use it in your projects, commercial or otherwise. See
imagebox-license.txtfor the full text.
SizeModeproperty. This allows you to switch between
Stretchmodes. Stretch is a new mode for the
ImageBox, and acts similar to existing
Fitfunctionality except the aspect ratio is not preserved.
SizeToFitproperty has been marked as deprecated and should no longer be used. The
SizeModeproperty has a
Fitvalue that should be used instead. Setting the
SizeToFitproperty will now manipulate
CenterPointproperty. This property returns the pixel at the center of the current image viewport.
Sizeto also accept
Zoomedevent that uses new
ImageBoxZoomEventArgsarguments. This new event allows you to tell if the zoom was in or out, how it was raised, and current and previous zoom values. Not hugely thrilled with how aspects of this change has been internally implemented, so implementation methods are private rather than virtual so I can change them without affecting the signature.
CenterToImagemethod which resets the viewport to be centered of the image, in the same way as zooming via the keyboard used to work.
Fontproperties are now available and, if set, will be displayed in the control. You can use the
ScaleTextproperties to determine how the text will be rendered.
DrawLabelmethod that performs text drawing is available for use by custom implementations or virtual modes.
Zooming in and out with the keyboard now keeps the view centered to the same pixel that was centered prior to the zoom
Zooming in and out with the keyboard is now correctly disabled
AllowZoom property is
False, or the
property is a value other than
Normal. This means keyboard
behaviour now matches mouse behaviour.
If the mouse wheel was rapidly spun (thus having a multiple of
the base delta), the
Zoom property was only adjusted once
GridScale property to
None rendered the
Small grid. Using a scale of
None now correctly
just fills the grid area with a solid brush from the
MouseWheel event is now available
Layout changes no longer occur if the
false through use of the
Fixed various documentation errors
Like what you're reading? Perhaps you like to buy us a coffee?