The colour chooser is a wrapper for the Windows' colour chooser common dialog. I'm sure you have all seen this, so there is no need to explain too much further. Suffice to say, this should allow you to set all of the options that are relevant to you.
|
| Prototype |
Description |
|
|
void SetInitialColour(COLORREF Colour);
|
This function sets the default colour that is selected when the dialog is opened.
|
|
void SetCustomColour(int Index, COLORREF Colour);
|
The dialog has 16 custom colours down at the bottom of the dialog. Here you can set the colours that are there. The index goes from 0 to 15.
|
|
void SetFullOpen(bool Set);
|
This option sets whether the dialog is fully open when executed (ie. shows the usual palette plus the full palette, instead of just the usual palette, and then the full palette when you click the appropriate button). Pass TRUE to make the dialog show both panels at the start, or FALSE to just show the ordinary one to start off with.
|
|
void SetPreventFullOpen(bool Set);
|
There is another option available, which is to disable the capability to open the dialog up fully. You can set that here. Pass TRUE to prevent the dialog from being able to be fully opened, and FALSE to allow the dialog to work normally.
|
|
bool Execute(HWND Owner);
|
This function applies the options and shows the dialog. It returns TRUE if the user clicked Ok, otherwise it returns FALSE. You need to supply a handle to a window that this dialog is child to. If you want, you can make this NULL, and then the dialog has no owner.
|
|
COLORREF GetColour(void);
|
This function retrieves the colour that the user selected from the dialog. If the user clicked cancel or closed the dialog with the 'X' button, this colour will be the same as the last time that the dialog was closed by clicking Ok, or the same as what you originally set it to.
|
|
COLORREF GetCustomColour(int Index);
|
Through the dialog, users can choose 16 custom colours. Should you wish to save these for the next time the user wishes to use the program, you can retrieve them from here. Index can be from 0 to 15.
|
The following snippet gives a basic idea of how to use this component.