ColorCount example for C++ Builder
This example displays a message box showing the number of unique colors in the control's current bitmap.
AnsiString szMessage;
int NumberOfColors;
// Get the number of colors in the bitmap.
NumberOfColors = Lead1->ColorCount;
// Display the result in a message.
szMessage = "The bitmap has " + IntToStr(NumberOfColors) + " colors";
ShowMessage(szMessage);