- Added new
MouseWheelMode
property to control how the mouse wheel is used to interact with the control. When set toZoom
(default), the wheel will scroll the control in and out. When set toScrollAndZoom
, the wheel scrolls the control vertically. Holding downShift
will scroll horizontally, orControl
to zoom (#18).
- Panning only worked if the horizontal scrollbar was present (#45)
- Added
PanMode
property. This property allows you to determine if panning can be triggered by the left mouse button, the middle mouse button or both. This property replaces theAutoPan
property. - Added
AllowFreePan
property. This property determines if panning only occurs when the mouse button is pressed, or if pressing the mouse button starts free panning and pressing any other button cancels the pan. Free panning only applies when using the middle mouse button.
- The
AutoPan
property has been deprecated and will be removed in a future version
- Any exception during image painting will now be caught, and the error text printed in lieu of the image
- Fixed a crash that could occur when dragging a selection if the selection was empty
- Reworked events to have less overhead
- Switched to semantic versioning
- Fixes the
FitRectangle
method from increasing the width or height of the source rectangle ifX
orY
were negative (generally seen when theSelectionMode
is set toRectangle
and you draw outside the bounds of the image area) - Resizing the selection in the
ImageBoxEx
control now works correctly even if the mouse passes outside the bounds of the image
- Added
AllowUnfocusedMouseWheel
property. If set totrue
the control will support mouse wheel zooming even when it does not have focus
- The
fitToBounds
parameter of thePointToImage
wasn't being used correctly
- Added new
MaximumSelectionSize
property to the demonstrationImageBoxEx
control that allows for more control over default selection - Added new overloads to
ZoomIn
andZoomOut
to determine if the center point should be preserved
- Refactored zoom handling for mouse and keyboard to avoid duplicate calculations
- Updated copyright year
- Zooming in or out using the default keybinds now preserves the center point relative to the new zoom
- Fixed the About dialog in the demonstration program not loading the default tab correctly
ImageBoxEx
example control now correctly allows you to move and resize selection regions even when the control is zoomed
- If the
InterpolationMode
property is set toDefault
, theImageBox
control will now choose an appropriate mode based on the current zoom levels
- Added new
DrawBackground
virtual method. This allows you to override how theImageBox
draws the image background without having to override the entireOnPaint
method
- Added a new
TextPadding
property and correspondingDrawLabel
overload. When this property is set, rendered text from theText
andTextAlign
properties is drawn with the appropriate padding. If theTextBackColor
property is set to something not fully transparent, then the background will be filled in the original render spot, excluding the padding, allowing for labels with wider background borders
- Added a new Resizable Selection demo. This demo makes use of a subclass of
the
ImageBox
to add native dragging and resizing of the region defined by theSelectionRegion
property
DrawImage
now also ignoresOutOfMemoryException
exceptions- Removed requirement for .NET 3.5 thanks to a commit from dahmage
- Added
GetScaledRectangle
overloads usingPoint
andSize
(and the float variant) parameters
- Calling
SelectAll
caused a crash if a backing image wasn't present (even ifVirtualMode
was set)
- Removed unnecessary
UpdateStyles
calls - Changed the
ViewSize
property andDrawImage
methods to handle disposed images rather than bringing down an entire application - Added
TextFormatFlags.NoPadding
to the flags used byDrawLabel
to avoid a slight gap on left aligned text - Fixed a potential crash calling
GetSelectedImage
. Thanks to MutStarburst for finding this bug
- Added NuGet package
- 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 - 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. Seelicense.txt
for the full text - 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
method 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 - 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
- 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
- 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 new DragTestForm demo
- Added new
Tiny
setting forImageBoxGridScale
which is half the size ofSmall
- The
Selecting
event now usesImageBoxCancelEventArgs
in order to provide further information
- If the
Selecting
event was cancelled, it would continue to be re-raised with every movement of the mouse while the button was pressed. Now the event is only raised once, and if cancelled will not be raised again until the button is released and a new drag initiated
- Changed
PixelGridThreshold
into an instance property, and changed default value to5
- Added missing
GetOffsetRectangle
overload which supportsRectangle
structs
- The
ZoomToFit
method didn't support virtual mode and crashed if called
- Added
IsPointInImage
method. This function returns if a given point is within the image viewport, and is useful for combining withPointToImage
- Added
ImageBorderColor
property, allowing you to customize the color of the image border - Added a new
ImageBoxBorderStyle
,FixedSingleGlowShadow
. This style allows for a more smoother outer glow shadow instead of the existing clunky drop shadow - Added
ShowPixelGrid
andPixelGridColor
properties. When set, a dotted grid is displayed around pixels when zooming in on an image - Added new overload to
PointToImage
which allows you to specify if the function should map the given point to the nearest available edge(s) if the point is outside the image boundaries - Added
AllowDoubleClick
property. When set, the normal double click events and overrides work as expected - Additional documentation added via XML comments
- If the
GridDisplayMode
property is set toImage
an explicit image border is no longer drawn, instead theImageBorder
property is correctly honoured - Fixes a problem where half the pixels of the first row/column were lost when zooming. Thanks to Rotem for the fix
- The
GetImageViewport
method now correctly returns a width and height that accounts for control size, padding and zoom levels - Fixed incorrect attributes on
AutoSize
property - Fixes "see also" documentation errors for events
- Added
VirtualMode
andVirtualSize
properties. These new properties allow you to use all functionality of the ImageBox control without having to set theImage
property. You can also use the newVirtualDraw
event to provide custom drawing without having to override existing drawing functionality
- Fixed the image viewport sometimes being the incorrect size when zoomed in. Thanks to WMJ for the fix
- Added a
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 - New
CenterAt
andScrollTo
methods allow you to scroll to a given location in the source image - Split shortcut handling into two methods
ProcessScrollingShortcuts
for handling arrow keys andProcessImageShortcuts
for handling pretty much anything else - Added
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 - Added a new
GetSelectedImage
method which creates a newBitmap
based on the current selection - Added new
FitRectangle
method which takes a given rectangle and ensure it fits within the image boundaries - Added a new
ZoomToRegion
method. This will caculate and appropriate zoom level and scrollbar positions to fit a given rectangle - Added new
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
- Zooming with the mouse is now smoother, and the control attempts to keep the area under the mouse before the zoom in the same area after the zoon.
- The
ZoomIncrement
property has been removed due to the introduction of the new zoom levels - Zooming can now be performed by the -/+ keys (
OemMinus
andOemplus
) - When zooming (except via mouse action), if the
AutoCenter
property is set, the control will always center the image even when scrollbars are present - Nestable
BeginUpdate
andEndUpdate
methods allow you to disable and enable painting of the control, for example when changing multiple properties at once - The
AllowClickZoom
property now defaults tofalse
- The
PointToImage
function no longer adds +1 to the result of the function
- Panning no longer tries to activate if no scrollbars are visible
- A new base class,
VirtualScrollableControl
is now used instead ofScrollableControl
. This removes completely the flicker issues present in previous versions of the control - The BorderStyle property has been moved to the
ScrollControl
class, so that borders now correctly surround the control (including scrollbars) rather than just the client area - If the
AllowZoomClick
property istrue
, the control no longer magically zooms after panning or selecting a region. Code previously in theOnMouseClick
override is now inOnMouseUp
- If both
AutoPan
and a validSelectionMode
are set, only selections are processed, instead of the control tying to do both. As a result of this fix, setting theSelectionMode
property no longer resetsAutoPan
- With the introduction of the
VirtualScrollableControl
, theMouseWheel
event is now raised as expected
- The
ScrollProperties
class hasn't been fully integrated with theScrollControl
, setting properties on this class won't update the owner control
- Initial GitHub release