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
ImageBox
control is licensed under the MIT license, allowing you free reign to use it in your projects, commercial or otherwise. Seeimagebox-license.txt
for the full text. - Added a new
SizeMode
property. This allows you to switch betweenNormal
,Fit
andStretch
modes. Stretch is a new mode for theImageBox
, and acts similar to existingFit
functionality except the aspect ratio is not preserved. - The
SizeToFit
property has been marked as deprecated and should no longer be used. TheSizeMode
property has aFit
value that should be used instead. Setting theSizeToFit
property will now manipulateSizeMode
instead. - Added a new
CenterPoint
property. 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
Rectangle
,Point
orSize
to also acceptfloat
andint
arguments. - Added a new
Zoomed
event that uses newImageBoxZoomEventArgs
arguments. 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
CenterToImage
method 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.
- The
Text
andFont
properties are now available and, if set, will be displayed in the control. You can use theForeColor
,TextBackColor
,TextAlign
,TextDisplayMode
andScaleText
properties to determine how the text will be rendered. - A new
DrawLabel
method that performs text drawing is available for use by custom implementations or virtual modes.
Demonstration Changes
- 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
ImageBox
. - Added new Text and Size Mode demonstrations.
Bug Fixes
- 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
AllowZoom
property isFalse
, or theSizeMode
property is a value other thanNormal
. 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 - Setting the
GridScale
property toNone
rendered the defaultSmall
grid. Using a scale ofNone
now correctly just fills the grid area with a solid brush from theGridColor
property. - The
MouseWheel
event is now available - Layout changes no longer occur if the
AllowPainting
property isfalse
through use of theBeginUpdate
method. - Fixed various documentation errors
Downloads
As usual, either grab the source from GitHub, from the link below, or make use of the NuGet package!
Downloads
- Cyotek.Windows.Forms.ImageBox.zip (1.62 MB)
All content Copyright © by Cyotek Ltd or its respective writers. Permission to reproduce news and web log entries and other RSS feed content in unmodified form without notice is granted provided they are not used to endorse or promote any products or opinions (other than what was expressed by the author) and without taking them out of context. Written permission from the copyright owner must be obtained for everything else.
Original URL of this content is http://www.cyotek.com/blog/imagebox-1-1-4-0-update?source=rss