Skip to content

TMSFNCColorWheel

TTMSFNCUIPack111

The TMSFNCColorWheel is a component for color selection. It includes the color wheel itself, sliders and edit fields for the R, G and B values and a HEX edit field as well.

Properties

Property name Description
BValue The BValue property can be used to set/retrieve the B value of the currently selected color.
GValue The GValue property can be used to set/retrieve the G value of the currently selected color.
HEXValue The HEXValue property can be used to set/retrieve the HEX value of the currently selected color.
RValue The RValue property can be used to set/retrieve the R value of the currently selected color.
SelectedColor The SelectedColor property can be used to set/retrieve the selected color.

Methods

Method name Description
ColorToBValue(AColor: TTMSFNCGraphicsColor) Returns the B value of the AColor parameter.
ColorToGValue(AColor: TTMSFNCGraphicsColor) Returns the G value of the AColor parameter.
ColorToRValue(AColor: TTMSFNCGraphicsColor) Returns the R value of the AColor parameter.
RGBToGraphicsColor(R, G, B: Integer) Returns a TTMSFNCGraphicsColor that is defined by the R, G and B parameter values.

Events

Event name Description
OnColorSelected Event called when the selected color has changed.
OnBValueChanged Event called when the B value has changed.
OnGValueChanged Event called when the G value has changed.
OnRValueChanged Event called when the R value has changed.

Color selection

Selecting a color can be done in multiple ways. You can either click and drag the mouse on the color wheel, use the RGB sliders and/or RGB edit fields or write a HEX value inside the given edit field. You can also preselect a color during design time via the SelectedColor property, and you can change the RValue, GValue and BValue properties too.

To access the selected color programmatically, you can use the TMSFNCColorWheel.SelectedColor property:

procedure TForm1.Button1Click(Sender: TObject);
begin
 TMSFNCColorWheel1.SelectedColor := gcDodgerblue;
end; 

TTMSFNCUIPack112

If only the R, G or B value needs to be changed then the RValue, GValue and BValue properties can be used:

procedure TForm1.Button2Click(Sender: TObject);
begin
 TMSFNCColorWheel1.BValue := 130;
end;

TTMSFNCUIPack113

You can retrieve or set the HEX value via the TMSFNCColorWheel.HEXValue property.