A newer version of this code is now available.
Today we've released a new updated version of the
ImageBox control, with a nice collection of enhancements and a few bug fixes.
Full change log for this update:
Changes and new features
- Added NuGet package
- Added a license file to hopefully cut down on questions about usage. The
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.
- Added a new
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
- Added a new
CenterPointproperty. This property returns the pixel at the center of the current image viewport.
- Added a bunch of missing XML comments documentation.
- Added new overloads for most methods that accepted a source
Sizeto also accept
- Added a new
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.
- Added new
CenterToImagemethod which resets the viewport to be centered of the image, in the same way as zooming via the keyboard used to work.
- Added support for animated GIF's, thanks to a contribution from Eggy. Note animations only play at runtime, not design time.
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.
- A new
DrawLabelmethod that performs text drawing is available for use by custom implementations or virtual modes.
- Added a new Scaled Adornments demonstration, showing how easy it is to add custom drawing that is scaled and positioned appropriately.
- Added a new Switch Image During Zoom demonstration, a demo with an unwieldy name that shows how to switch out a low resolution image with a higher detailed one as you zoom into an
- Added new Text and Size Mode demonstrations.
- 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 if the
False, or the
SizeModeproperty 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
Zoomproperty was only adjusted once
- Setting the
Nonerendered the default
Smallgrid. Using a scale of
Nonenow correctly just fills the grid area with a solid brush from the
MouseWheelevent is now available
- Layout changes no longer occur if the
falsethrough use of the
- Fixed various documentation errors
Related articles you may be interested in
- Displaying multi-page tiff files using the ImageBox control and C#
- Adding drag handles to an ImageBox to allow resizing of selection regions
- ImageBox and TabList update's - virtual mode, pixel grid, bug fixes and more!
- ImageBox update, version 126.96.36.199
- Zooming to fit a region in a ScrollableControl
- Zooming into a fixed point on a ScrollableControl
- Arcade explosion generator
- Creating an image viewer in C# Part 5: Selecting part of an image
- Extending the ImageBox component to display the contents of a PDF file using C#
- Creating a scrollable and zoomable image viewer in C# Part 4
- Creating a scrollable and zoomable image viewer in C# Part 3
- Creating a scrollable and zoomable image viewer in C# Part 2
- Creating a scrollable and zoomable image viewer in C# Part 1
Cyotek ImageBox Control, 188.8.131.52 update