ShowHistogramDlg example for C++ Builder

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

   LEADImage1->GetHistogram ( CHANNEL_MASTER ); 
   LEADDlgImage1->MasterHistogramLen = LEADImage1->HistogramTableSize; 

   for ( i= 0; i < LEADImage1->HistogramTableSize; i ++ ) 
   {
      LEADDlgImage1->MasterHistogram [i]= LEADImage1->HistogramTable[i]; 
   }

   LEADImage1->GetHistogram ( CHANNEL_RED ); 
   LEADDlgImage1->RedHistogramLen = LEADImage1->HistogramTableSize; 

   for ( i= 0; i < LEADImage1->HistogramTableSize; i ++ ) 
   {
      LEADDlgImage1->RedHistogram [i]= LEADImage1->HistogramTable[i]; 
   }

   LEADImage1->GetHistogram ( CHANNEL_GREEN ); 
   LEADDlgImage1->GreenHistogramLen = LEADImage1->HistogramTableSize; 

   for ( i= 0; i < LEADImage1->HistogramTableSize; i ++ ) 
   {
      LEADDlgImage1->GreenHistogram [i]= LEADImage1->HistogramTable[i]; 
   }

   LEADImage1->GetHistogram ( CHANNEL_BLUE ); 
   LEADDlgImage1->BlueHistogramLen = LEADImage1->HistogramTableSize; 

   for ( i= 0; i < LEADImage1->HistogramTableSize; i ++ ) 
   {
      LEADDlgImage1->BlueHistogram [i]= LEADImage1->HistogramTable[i]; 
   }

   LEADDlgImage1->HistogramFlags = HIST_LOWHIGH_BITS; 
   LEADDlgImage1->BlueChannelPenColor = RGB ( 0, 0, 255 ); 
   LEADDlgImage1->GreenChannelPenColor = RGB ( 0, 255, 0 ); 
   LEADDlgImage1->RedChannelPenColor = RGB ( 255, 0, 0 ); 
   LEADDlgImage1->MasterPenColor = RGB ( 0, 0, 0 ); 
   LEADDlgImage1->DlgFlags = DLG_HISTOGRAM_SHOW_VIEWSTYLE |
                            DLG_HISTOGRAM_USERPENCOLORS; 

   LEADDlgImage1->ShowHistogramDlg ( this ); 
}