Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Color picker control suite for Windows Forms applications.

License

NotificationsYou must be signed in to change notification settings

cyotek/Cyotek.Windows.Forms.ColorPicker

Repository files navigation

Icon Cyotek Color Picker Controls for Windows Forms

Build statusNuGet

TheCyotek.Windows.Forms.ColorPickers library contains aseries of custom controls and utility classes for Windows Formsapplications that work with colours. Controls are available toallow colour selection via a HSLColorWheel, aColorGridwith many customisation options, aColorEditor for enteringcolours via RGB or HSL, and aScreenColorPicker for capturingcolours from running applications.

Color palettes can be loaded and saved in a number of differentformats, including Adobe PhotoShop Color Swatch files, JASCPalettes, Gimp Palettes and more (see Color Palettes andExternal Palette Files below).

For more information on these controls, see thearticles taggedwithcolorpicker at cyotek.com.

Getting the library

The easiest way of obtaining the library is viaNuGet.

Install-Package Cyotek.Windows.Forms.ColorPicker

If you don't use NuGet, pre-compiled binaries can be obtainedfrom theGitHub Releases page.

Of course, you can always grabthe source and build ityourself!

Controls

There are three primary controls (ColorGrid,ColorWheel andColorEditor), along with 5 utility controls(ScreenColorPicker,RgbaColorSlider,HueColorSlider,LightnessColorSlider andSaturationColorSlider), amanagement component (ColorEditorManager) and one dialog(ColorPickerDialog). Combined together, these provide a decentarray of tools for colour selection.

ColorGrid Control

ColorGrid control demonstration

This control displays a grid of colours, and supports both aprimary palette, and a custom colour palette. Several propertiesare available for configuring the appearing of the control, andthere are behaviour options too, such as built in editing ofcolours and support for automatically adding new colours not inthe primary palette.

ColorWheel Control

ColorWheel control demonstration

This control displays a radial wheel of RGB colours and allowsselection from any point in the wheel. TheShowAngleArrow,ShowCenterLines andShowSaturationRing properties can beused to display useful adornments, while theLightness andAlpha properties can be used to compose the final colour whilenot being directly editable on the wheel.

TheSecondaryColors andSecondarySelectionSize propertiesallow you to display additional colours on the wheel, forexample for showing relationships.

ColorSlider Controls

ColorSlider controls demonstration

A bunch of controls (inheriting from a single base) that allowselection of values via a colourful bar. Similar to theTrackBar control you have a few options for specifying thedrag handle's position and bar orientation. You can alsocustomise the fill and outline colour, or replace it completelywith a custom image.

ColorEditor Control

ColorEditor control demonstration

This control allows the editing of a RGB or HSL colour via astandard interface. You can also enter colours via 6 or 8character hexadecimal notation, or choose from named web andsystem colors.

Use of the alpha channel can be configured via theShowAlphaChannel andPreserveAlphaChannel properties. TheShowHex,ShowHsl andShowRgb properties can be used toshow or hide groups of editors.

Alternatively, theNubSize,NubColor andNubOutlineColorproperties can be used to customise the appearance of thesliders.

ScreenColorPicker Control

ScreenColorPicker control demonstration

This control allows the user to pick a colour from any pixeldisplayed on the screen. The user can either trigger theoperation by clicking and dragging the control, or it can bedone programmatically via theCaptureMouse method, allowingselections to be triggered via other actions, for example a hotkey. TheZoom property can be used set the grid size of thepreview.

ColorPickerDialog Form

ColorPickerDialog form demonstration

This form puts together the previous controls in a ready to usedialog.

Custom colours are supported via theCustomColors property,and users can also load or save external palette files intothese. You can use theShowLoad andShowSave properties toenable or disable this, and theCustomColorsLoading andCustomColorsSavingevents to override the built-in behaviourand provide your own logic.

ColorEditorManager

ColorEditorManager compnent demonstration

This is a non-GUI component that you can drop onto a form, andbind to other controls in this library. When theColorproperty of one control changes, it is reflected in the otherswithout having to lift a finger. Useful if you're creatingcomposite displays from multiple controls.

Color Palettes and External Palette Files

TheColorGrid control hasColors andCustomColorsproperties which return aColorCollection. These twoproperties make it easier as a developer to keep separate aprimary palette whilst having the flexibility of custom colours,although it does complicate the control's internal logic a bit!The grid will automatically populate custom colours if you tryand set the control'sColor to a value not currently defined.

As well as manually populatingColorCollection instances, youcan also load in external palette files. The following paletteformats are supported:

  • Adobe Color Table (*.act)
  • Adobe PhotoShop Color Swatch (*.aco)
  • GIMP (*.gpl)
  • Deluxe Paint (*.bbm; *.lbm) [read only]
  • JASC (*.pal)
  • Paint.NET (*.txt)
  • Raw RGB Triplets (*.pal)

With the exception of the ILBM image format, all other formatscan be exported as well as imported.

Additional palette serializers can be easily created by adding aclass which implementsIPaletteSerializer. TheColorPickerDialog (or any custom code usingPaletteSerializer static methods) will automatically detectand make available custom palettes via reflection.

Keyboard Support

All GUI components, with the exception of theScreenColorPicker include full keyboard/focus support. Manycontrols supportSmallChange andLargeChange propertieswhich influence how navigation keys are processed. Although inthe case of theColorWheel it's not really a bonus... butthat's what theColorEditor control is best suited for!

Requirements

.NET Framework 3.5 or later.

Pre-built binaries are available via a signedNuGetpackage containing the following targets.

  • .NET 3.5
  • .NET 4.0
  • .NET 4.5.2
  • .NET 4.6.2
  • .NET 4.7.2
  • .NET 4.8
  • .NET 5.0

Contributing to this code

Contributions accepted!

Alternatively, if you make use of this software and it saves yousome time, donations are welcome.

PayPal Donation

By Me a Coffee Donation

Known Issues

  • XML documentation comments are incomplete

Related Reading

Acknowledgements

About

Color picker control suite for Windows Forms applications.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp