GetColorCount Example for Visual J++

This example displays a message box showing the number of unique colors in the control's current bitmap.

// Get the number of colors in the bitmap.
int nNumberOfColors = LEAD1.GetColorCount();

// Display the result in a message.
String strMessage = "The bitmap has " + nNumberOfColors + " colors";
MessageBox.show( strMessage, "Notice", MessageBox.OK );