UserPalette and BitmapPalette example for C++ Builder
This example demonstrates the UserPalette and BitmapPalette properties.
//Specify a blue and white user palette
Lead1->UserPalette[0] = RGB(0, 0, 255);
Lead1->UserPalette[1] = RGB(255, 255, 255);
//Implement the user palette
Lead1->ColorRes(1, CRF_USERPALETTE, CRF_ORDEREDDITHERING, 2);
//Display the blue and white image
Lead1->ForceRepaint();
ShowMessage("This is the user palette. Click OK to change the bitmap palette. ");
//Change the bitmap palette to red and white
Lead1->BitmapPalette[0] = RGB(255, 0, 0);
Lead1->BitmapPalette[1] = RGB(255, 255, 255);
//Display the red and white image
Lead1->ForceRepaint();