ShowCustomizePaletteDlg method (LEADDlgColor Control)

C++ Builder example

Delphi 4.0 example

 

Builder Syntax

int ShowCustomizePaletteDlg(TWinControl* AOwnerCtrl);

Delphi Syntax

Function ShowCustomizePaletteDlg (AOwnerCtrl: TWinControl ): L_INT;

Overview

Refer to Using Imaging Common Dialogs.

Remarks

Displays the Customize Palette dialog box. This dialog box allows you to create, save, load, or edit custom palettes.

The layout and action of the dialog depends on the flags set in the DlgFlags property. Possible options are:

Value

Meaning

 

DLG_CUSTOMIZEPALETTE_SHOW_CONTEXTHELP

[$00000001] Dialog should contain a context sensitive help icon.

 

DLG_CUSTOMIZEPALETTE_SHOW_SORT

[$00000002] Dialog should contain the Sort button.

 

DLG_CUSTOMIZEPALETTE_SHOW_FINDCLOSEST

[$00000004] Dialog should contain the Find Closest button.

 

DLG_CUSTOMIZEPALETTE_SHOW_ADDOPTION

[$00000008] Dialog should contain the Add Options button.

 

DLG_CUSTOMIZEPALETTE_SHOW_REMOVEOPTION

[$00000010] Dialog should contain the Remove Options button.

 

DLG_CUSTOMIZEPALETTE_SHOW_COLORMODEL

[$00000020] Dialog should contain the Color Model button.

 

DLG_CUSTOMIZEPALETTE_SHOW_RGBLEFTPAN

[$00000040] Dialog should contain the left pan RGB static control.

 

DLG_CUSTOMIZEPALETTE_SHOW_HTMLLEFTPAN

[$00000080] Dialog should contain the left pan HTML static control.

 

DLG_CUSTOMIZEPALETTE_SHOW_INDEXLEFTPAN

[$00000100] Dialog should contain the left pan Index static control.

 

DLG_CUSTOMIZEPALETTE_SHOW_RGBRIGHTPAN

[$00000200] Dialog should contain the right pan RGB static control.

 

DLG_CUSTOMIZEPALETTE_SHOW_HTMLRIGHTPAN

[$00000400] Dialog should contain the right pan HTML static control.

 

DLG_CUSTOMIZEPALETTE_SHOW_INDEXRIGHTPAN

[$00000800] Dialog should contain the right pan Index static control.

 

DLG_CUSTOMIZEPALETTE_SHOW_NEW

[$00001000] Dialog should contain the new button.

 

DLG_CUSTOMIZEPALETTE_SHOW_OPEN

[$00002000] Dialog should contain the open button.

 

DLG_CUSTOMIZEPALETTE_SHOW_SAVE

[$00004000] Dialog should contain the save button.

 

DLG_CUSTOMIZEPALETTE_SHOW_SAVEAS

[$00008000] Dialog should contain the save as button.

 

DLG_CUSTOMIZEPALETTE_GENERATE_PALETTE

[$00010000] Dialog should update the GeneratedPaletteColors property with the user created palette in the right pane, and the GeneratedPaletteColorsCount property with the number of valid colors in the GeneratedPaletteColors property..

 

DLG_CUSTOMIZEPALETTE_SHOW_APPLYPALETTEWHENEXIT

[$00020000] Dialog should contain the "Apply When Exit" check box, and the dialog will update the GeneratedPaletteColors property with the user created palette in the right pane, and the GeneratedPaletteColorsCount property with the number of valid colors in the GeneratedPaletteColors property. Notice that you can’t combine this flag with flag DLG_CUSTOMIZEPALETTE_GENERATE_PALETTE.

 

The following properties are associated with this dialog:

UserPaletteColors property

UserPaletteColorsCount property

GeneratedPaletteColors property

GeneratedPaletteColorsCount property

ApplyPaletteWhenExit property.

To include a Help button in the dialog, set the ShowHelpButton property to TRUE.

The Customize Palette dialog can be seen below:

image\CustomizePalette.gif

This dialog has the following fields:

Palettes List:

The Palette List provides you with some standard palettes:

- System Colors This palette contains colors used by MS Windows when the screen mode is 256-colors.

- Netscape Palette This is the palette used by Netscape browsers.

- MSIE Palette This is the palette used by Microsoft Internet Explorer browsers.

- Gray Scale Palette This palette contains 256 shades of gray (such as the shades found in a "black & white" photograph).

- Standard VGA Palette This is the palette used by VGA monitors.

- Uniform Palette This palette contains a set of colors uniformly distributed across the set of all 16 million 24-bit colors.

If you pass a palette to the dialog the "Image Colors" item is added to the palette list to view the current colors in the passed palette.

Left Pane:

The Left Pane of the Customize Palette dialog displays the colors that you can add to your palette. This pane is not editable and it has two modes of display; it either displays lists of individual colors (palettes), or continuous colors based on a particular color model. When displaying palettes, you can select multiple individual colors using the <Ctrl> key, and a range of consecutive colors using the <Shift> key.

Right Pane:

The Right Pane of the Customize Palette displays the list of colors that you have chosen. (It is empty until you begin to choose colors). After selecting a single color or a group of colors in the left pane, you can add them to your list of chosen colors in the right pane by clicking the Add button or by dragging them into the right pane. You can re-arrange the colors in the right pane by clicking and dragging them to their new position, or by using one of the pre-defined sort methods listed in the Sort drop-down list box.

Color Value Display:

The RGB components and corresponding HTML form of the currently selected color are displayed at the bottom of the dialog.

Color Model Button:

The Color Model button will list the color models available for the left pane and can switch the display mode in the left pane.

Clicking this button will activate a menu with the following options:

- Palette. This option is the default. Choosing this option will activate the Palette drop-down list box and display the available colors in the Left Pane.

- HSB-Hue Based Choosing this option will open the HSB-Hue Based Model in the Left Pane. 

- HSB-Wheel Based Choosing this option will open the HSB-Wheel Based Model in the Left Pane. 

- HSB-Brightness Based Choosing this option will open the HSB-Brightness Based Model in the Left Pane. 

- RGB-3D Additive Choosing this option will open the RGB-3D Additive Model in the Left Pane. 

- CMY-3D Subtractive Choosing this option will open the CMY-3D Subtractive Model in the Left Pane. 

- CMYK-3D Subtractive Choosing this option will open the CMYK-3D Subtractive Model in the Left Pane. 

- Lab-Device Independent Choosing this option will open the Lab-Device Independent Model in the Left Pane. 

Replace Button:

The Replace button replaces a number of selected items in the Right pane with the same number and order of selected items from the Left pane.

Add and Add Options:

The Add button adds an item or a group of items selected in the Left pane into the Right pane. Items can also be added from the Left pane to the Right pane by dragging them. Notice that the mouse cursor changes into a hand image\HandClosed.gif when dragging item(s). If the cursor is not in a valid insert area, the cursor will turn into image\PalEdit_Stop.gif.

The Add Options button (the down arrow button to the right of the Add button) activates a menu that contains options indicating where those items should be added. The default is "At the end". The options included in this menu are as follows:

- At the End Add all insertions at the end of the list in the Right Pane. 

- After Selected Add all insertions after the selected item. Notice that if no items are selected in the Right Pane the Add operation will fail and an error message will appear. This will also occur if more than one item is selected in the Right Pane. 

- Before Selected Add all insertions before the selected item. Notice that if no items are selected in the Right Pane the Add operation will fail and an error message will appear. This will also occur if more than one item is selected in the Right Pane. 

Note: If "After Selected" or "Before Selected" is chosen, the add operation will only be performed if there is exactly one item selected in the right pane.

"Add Options" is displayed only if the DLG_CUSTOMIZEPALETTE_SHOW_ADDOPTION flag is passed through the DlgFlags property.

Remove and Remove Options:

The Remove button removes the selected item(s) from the Right Pane. Items can also be removed by dragging them out of the Right Pane. Notice that the mouse cursor changes into image\PalEdit_Trash.gif to indicate the item is about to be deleted.

The Remove Options button (the down arrow button to the right of the Remove button) activates a menu that allows you to set whether or not to be notified by a warning message when an item is about to be removed. The options included in this menu are as follows:

Confirm When this option is checked a confirmation message will appear whenever you remove an item.

Find Closest Button:

The Find Closest button highlights the item in the Right Pane that is the closest match to the item selected in the Left Pane. This button is displayed only if the DLG_CUSTOMIZEPALETTE_SHOW_FINDCLOSEST flag is passed through the DlgFlags property.

Sort:

The Sort button allows you to choose a method for sorting items in the right pane depending on their color components. Clicking the button will activate a menu with the following options:

- HSB Clicking this option will sort all items in the Right Pane according to their HSB color components. 

- HUE Clicking this option will sort all items in the Right Pane according to the Hue value of their HSB color components. 

- Saturation Clicking this option will sort all items in the Right Pane according to the Saturation value of their HSB color components. 

- Brightness Clicking this option will sort all items in the Right Pane according to the Brightness value of their HSB color components. 

- RGB Clicking this option will sort all items in the Right Pane according to their RGB color components. 

- Reverse Clicking this option will invert the order of all items in the Right Pane. 

Note: "Sort" is displayed only if DLG_CUSTOMIZEPALETTE_SHOW_SORT flag is passed through the DlgFlags property.

Apply When Exit Check box:

When you pass the DLG_CUSTOMIZEPALETTE_GENARATE_PALETTE flag, you can prompt the user to use the palette generated or not by using the DLG_CUSTOMIZEPALETTE_SHOW_APPLYPALETTEWHENEXIT flag which shows/hides the ‘Apply When Exit’ checkbox.

New:

Use the New button to empty the Right Pane. This button is displayed only if the DLG_CUSTOMIZEPALETTE_SHOW_NEW flag is passed through the DlgFlags property.

Open:

Use the Open button to open a previously saved palette file; palette files have the extension "ltp". This button is displayed only if the DLG_CUSTOMIZEPALETTE_SHOW_OPEN flag is passed through the DlgFlags property.

Save:

Use the Save button to save your palette. If you are starting a new file, the save command will prompt you for the file location and name. This button is displayed only if the DLG_CUSTOMIZEPALETTE_SHOW_SAVE flag is passed through the DlgFlags property.

Save as:

Use the Save as command to save a palette to a new filename. If you are starting a new file, the save command will prompt you for the file location and name. This button is displayed only if the DLG_CUSTOMIZEPALETTE_SHOW_SAVEAS flag is passed through the DlgFlags property.

Close:

Use the Close button to end the dialog. If there are changes unsaved on the Right Pane, a prompt message will appear.

See Also

Elements:

ShowColorResDlg method, ColorRes method, UserPaletteColors property, ApplyPaletteWhenExit property, UserPaletteColorsCount property, GeneratedPaletteColors property, GeneratedPaletteColorsCount property, ShowHelpButton property, ZoomToFit Property, DlgFlags property, EnableMethodErrors property.

Topics:

Imaging Common Dialogs: Properties, Methods, and Events