The ColorPicker Controls have been updated to version 126.96.36.199.
This is a fairly substantial update, with quite a few bug fixes and enhancements to the code.
What's next for the library?
I feel the code is starting to get a little bloated as the library is trying to serve two purposes - the primary purpose is for the selection of colours. However, it also provides the ability to load and save colour swatches in various formats, some of which has been the subject of posts on this blog.
Internally, we link to the individual files from the library in
our core product assemblies - all the UI stuff is in
Cyotek.Windows.Forms, and everything else is in
Cyotek.Drawing. I think it would probably be a good idea to
properly split up this library too. If you just want the UI, use
one library, if you want the extended palette serialisation
support, use the other. There is some overlap though so this
will need to be considered a bit first.
Of course splitting the library is a massive breaking change. I think future versions of our open source libraries will change to use Semantic Versioning so that it will be much clearer when things are being broken. Of course, it would be preferable if breaking changes weren't introduced all the time! This is also why I haven't added a NuGet package yet, when you update a package you don't expect to have to change your source code too.
Changes and new features
- Added new
AdobePhotoShopColorSwatchSerializerserializer for reading and writing Adobe PhotoShop colour swatches (both version 1 and version 2)
- You can now set the
Columnsproperty of a
0, which will then internally calculate columns based on the size of the control, the cell size, and the spacing. A new read-only
ActualColumnsproperty has been added which will allow you to get the real number of columns if required. The
AutoSizebehaviour has been changed so that only the vertical height of the control is adjusted when
- Save Palette button in the
ColorPickerDialognow obtains the serializer to use based on the selected filter index, allowing correct saving if multiple serializers use the same extension.
PaletteSerializer.GetSerializernow makes use of the above new method to access the relevant serializer rather than just matching extensions. This means if you have two serializers that support different .pal formatted files, these can now be loaded successfully, instead of one loading and one failing.
- Added new
RawPaletteSerializerwhich reads and writes palettes that are simply RGB triplets in byte form
- Added new
ColorPickerDialog. This property allows the alpha channel editing controls to be hidden, for when working with 8-bit colours.
- The rendering of the selected cell in a
Padding.Topto determine the size of the zoom box, avoiding massive boxes the larger the
- Added a new standard 256 colour palette. You can use this in
ColorGridby setting the
ColorPalette.Standard256or obtain the array of colours by calling
RgbaColorSlidercontrols now only create transparency brushes when required. A new virtual method
SupportsTransparentBackColorallows inheritors to create their own brushes if required.
ColorGrid, allowing the edit colour action to be cancelled, or replaced with a custom editor
GetCellOffsetmethods to the
- Added more tests
- Added new
ColorGridfor easier moving within the cells of the grid
ColorGridcontrol now tries to be smarter with painting, and only paints cells that intersect with the clip rectangle. In addition, where possible only individual cells are invalidated rather than the entire control.
- Corrected invalid error messages from the Save Palette
button in the
- Load Palette and Save Palette buttons in the
ColorPickerDialognow check the
CanWriteproperties of the serializer.
- Double clicking with any button other than the left in
ColorGridcontrol no longer attempts to initiate colour editing
- Setting the
Colorproperty of the
Color.Emptyno longer treats the value as a valid colour
ColorGridcontrol no longer defines custom colour regions when the
false. This manifested in hover and selection effects working if you moved your mouse over the bottom of a resized grid.
- Clicking "white space" areas of a
ColorWheelcontrol will no longer incorrectly set the colour to the closest matching point on the wheel itself. However, starting to select a colour within the wheel and then moving outside the bounds will continue to select the closest match as usual.
- Fixed a crash that occurred when creating controls that
- When the
false, unmatched colours will no longer be silently added to the
ColorGridcustom palette unexpectedly. This also resolves various crashes after the colour regions fix above was applied.
ColorWheelcontrol now makes use of
ButtonRenderer.DrawParentBackgroundto draw itself, to avoid ugly blocks of solid colours when hosted in containers such as the
ColorChangedevent has now been marked as the default event, so when you double click the component in the designer, a code window now correctly opens.
- If the underlying entry in a
ColorCollectionbound to a
ColorGridcontrol was modified, and this particular entry was the selected colour, the
ColorGridwould not keep its
Colorproperty in sync and would clear the selected index.
- Attempting to set the
Columnsproperty to less than zero now throws an
ArgumentOutOfRangeexception rather than setting it, then crashing later on
- Double clicking a colour in the grid of the
ColorPickerDialogno longer opens another copy of the
- Fixed problems in the
ColorGridwith keyboard navigation and initial focus if no valid colour index was set.
ColorCollection.Findmethod now correctly works when adding named colours (e.g.
Color.CornflowerBlue) to the collection, but searching by ARGB value (e.g.
Color.FromArgb(100, 149, 237))
- Fixed an issue where if the internal dictionary lookup in
ColorCollectionclass had been created and the collection was then updated, in some cases the lookup wasn't correctly modified.
- 2014-04-13 - First published
- 2020-11-21 - Updated formatting