Hue and Luminance Color Bars
In This Topic
The hue color bar lets the user to modify the hue component of a color. The luminance color bar allows the user to select darker or lighter variants of a given base color. They are represented by the NHueColorBar and NLuminanceColorBar classes respectively, both of which derive from the NColorBar base class. The hue and the luminance color bars are represented by the following images:
figure 1. Hue and Luminance Color Bars.
Properties and Events
The NHueColorBar and the NLuminanceColorBar classes share the following properties and events that they inherit from the base NColorBar:
Name |
Description |
SelectedValue |
Stores the currently selected value. When the selected value changes the SelectedValueChanged event is fired.
For a hue color bar the value is in the [0, 360) range. If the hue is not in the range [0, 360), it is normalized to be in that range.
For a luminance color bar the value is in the [0, 1].
|
Orientation |
Determines the orientation of the color bar. By default set to Vertical. |
ValueSelectorExtendPercent |
Determines the extension of the value selector pointers, measured as a percent of the color bar width/height for vertical/horizontal color bars respectively. By default set to 30%. |
UpdateWhileDragging |
determines whether the selected value should be updated while the user drags the Value selector. If set to false the selected value is updated when the user releases the left mouse button. By default set to true. |
BaseColor |
Specifies the color whose hue or luminance to modify respectively. |
Code Example
The following piece of code demonstrates how to create hue and luminance color bars and handle their ValueChanged event:
Hue Color Bar Example |
Copy Code
|
NHueColorBar hueColorBar = new NHueColorBar();
hueColorBar.SelectedValueChanged += new Function<NValueChangeEventArgs>(OnHueColorBarSelectedValueChanged);
...
NLuminanceColorBar luminanceColorBar = new NLuminanceColorBar();
luminanceColorBar.SelectedValueChanged += new Function<NValueChangeEventArgs>(OnLuminanceColorBarSelectedValueChanged);
..
private void OnHueColorBarSelectedValueChanged(NValueChangeEventArgs args)
{
float newHue = (float)args.NewValue;
}
private void OnLuminanceColorBarSelectedValueChanged(NValueChangeEventArgs args)
{
float newLuminance = (float)args.NewValue;
}
|