ShowCustomizePaletteDlg example for C++ Builder

void __fastcall TForm1::ShowCustomizePaletteDlg1Click(TObject *Sender) 
{
   L_INT i; 
   L_INT nRet; 

   LEADDlgColor1->UserPaletteColorsCount= 0; 

   LEADDlgColor1->DlgFlags = DLG_CUSTOMIZEPALETTE_SHOW_SORT                |
                           DLG_CUSTOMIZEPALETTE_SHOW_FINDCLOSEST         |
                           DLG_CUSTOMIZEPALETTE_SHOW_ADDOPTION           |
                           DLG_CUSTOMIZEPALETTE_SHOW_REMOVEOPTION        |
                           DLG_CUSTOMIZEPALETTE_SHOW_COLORMODEL          |
                           DLG_CUSTOMIZEPALETTE_SHOW_RGBLEFTPAN          |
                           DLG_CUSTOMIZEPALETTE_SHOW_HTMLLEFTPAN         |
                           DLG_CUSTOMIZEPALETTE_SHOW_INDEXLEFTPAN        |
                           DLG_CUSTOMIZEPALETTE_SHOW_RGBRIGHTPAN         |
                           DLG_CUSTOMIZEPALETTE_SHOW_HTMLRIGHTPAN        |
                           DLG_CUSTOMIZEPALETTE_SHOW_INDEXRIGHTPAN       |
                           DLG_CUSTOMIZEPALETTE_SHOW_NEW                 |
                           DLG_CUSTOMIZEPALETTE_SHOW_OPEN                |
                           DLG_CUSTOMIZEPALETTE_SHOW_SAVE                |
                           DLG_CUSTOMIZEPALETTE_SHOW_SAVEAS              |
                           DLG_CUSTOMIZEPALETTE_GENERATE_PALETTE; 
   LEADDlgColor1->LEADImage = LEADImage1; 
   LEADDlgColor1->LEADDlgService = LEADDlgService1; 
   nRet= LEADDlgColor1->ShowCustomizePaletteDlg ( this ); 
   if ( nRet == SUCCESS_DLG_OK ) 
   {
      if ( LEADDlgColor1->ApplyPaletteWhenExit
         Edit1->Text= "True";
      else
         Edit1->Text= "False";

      for ( i= 0; i < LEADDlgColor1->GeneratedPaletteColorsCount; i ++ ) 
      {
         LEADImage1->UserPaletteColors [i]= LEADDlgColor1->GeneratedPaletteColors [i]; 
      }
   }
}