EqapColorBox (version 1.2, 12.01.2008)

The EqapColorBox is a part of EqapPackage and is a visual component designed to choose a color from the given number of color palettes.


1. Appearance

The EqapColorBox (Fig. 1) has the area to draw a selected palette (a), the control to select current palette (b), and the small field to draw the selected color (c).

Fig. 1. EqapColorBox component

To choose a color, just click left or right mouse button over the desired color position within selected color palette. The field (c) indicates the current color selection. To select a palette from the set of predefined palettes use up and down buttons of the control (b).


2. Properties and events

The EqapColorBox inherits properties and events of TPanel except those used for text appearance (Alignment, AutoSize, Caption, Font etc.), and has own properties and events:

Properties

Options: TEqapColorBoxOptions - component options. The option ecboCycledPaletteSelection indicates whether a cyclic change of color palettes (from the predefined set) should take place, when an user clicks on the control (b). If the option is "true", then the first predefined palette will follow the last one, and vice cersa. The default value is "false".

Palette: TEqapColorBoxPalette - current color palette. The available values are: ecbpBlackWhite (black and white colors), ecbpSmoothedGrayScale (smooth gradient of gray-scale colors), ecbpSmoothedRainbow (smooth gradient of rainbow colors), ecbpSomeColorSet (user-defined colors), ecbpSteppedGrayScale (stepped gradient of gray-scale colors, see an example on Fig. 1), ecbpSteppedRainbow (stepped gradient of rainbow colors). The default value is "ecbpBlackWhite".

SelColor: TColor - selected color.

SelColorShape: TEqapColorBoxShape - drawing style of the field for selected color (Fig. 1, c). Sub-properties are Brush: TBrushFormat (background style of the field), Height: integer (height of the field), LeftIndent: integer (an interval between left margin of component and left margin of the field), Pen: TPenFormat (border style of the field), RightIndent: integer (an interval between right margin of the field and left margin of area to draw a selected palette), ShapeType: TShapeType (field shape), Width: integer (width of the field).

Events

OnSelectColor: TNotifyEvent - event arises when current color has been changed by an user (mouse is clicked or moved over the color palette area when left mouse button was pressed).

OnSelectPalette: TNotifyEvent - event arises when a color palette has been changed.


3. The example of using

The program code with an example of use of EqapColorBox is downloadable here. This example illustrates how you can change the color of a visual component (TPanel) when OnSelectColor event of EqapColorBox is occurred.


All the software products are free for use. Any commercial using is not permitted without author's permission (o.lookin@iip.uran.ru).

 

Hosted by uCoz