Bitmap Widget - Max Pens

 
The MAX PENS attribute specifies the maximum number of pens a BITMAP can change and use. Each system has a finite number of pens: 2, 16, 64, 256, etc. Each BITMAP widget has its own logical color map with each map containing up to the same number of pens as the physical color map.
 
The BITMAP widget that has the focus will set the physical color map to its color map.  All other Windows applications, including the remaining BITMAP widgets, will redefine their pen usage to best use the new physical color map on a closest match basis.
 
Since it is computationally expensive to remap the color map and pen usage, each BITMAP widget will use a non-overlapping portion of the physical color map. Therefore, remapping will not occur if the sum of all BITMAP widgets' MAX PENS is less than the physical pens available.
 
If a BITMAP requires 100 different colors (see the "PENS NEEDED" attribute) and MAX PENS is set to "70", the 30 least frequently-used pens of that BITMAP will be mapped into the 70 on a closest-match basis. Setting MAX PENS to "0" makes the BITMAP widget map to the Windows default colors so that remapping never occurs.