Important: The information in this document is obsolete and should not be used for new development.
SetControlColor
To draw a control using colors other than the default colors used by system software, you can use theSetControlColor
procedure. TheSetControlColor
procedure is also available as theSetCtlColor
procedure.
PROCEDURE SetControlColor (theControl: ControlHandle; newColorTable: CCTabHandle);
theControl
- A handle to the control whose colors you wish to change.
newColorTable
- A handle to a control color table record.
DESCRIPTION
TheSetControlColor
procedure changes the color table for the specified control. If the control currently has no auxiliary control record,SetControlColor
creates one that includes the control color table record specified in the parameternewColorTable
and adds the auxiliary control record to the head of the auxiliary control list. If there
is already an auxiliary record for the control,SetControlColor
replaces its color
table with the contents of the control color table record specified in the parameternewColorTable
.To use nonstandard colors for a control, you must create a control color table, either by creating a color control table record and calling
SetControlColor
or by creating a control color table resource. Generally, you useSetControlColor
when you create
a control usingNewControl
and want to use nonstandard colors for it or when you change any control's colors after you've created it. When you want to use nonstandard colors for those controls you create in a control ('CNTL') resource, you should create a control color table
('cctb'
) resource with the same resource ID as the control resource.A control whose colors you set with
SetControlColor
should initially be invisible. After usingSetControlColor
to set the control's colors, use theShowControl
procedure to make the control visible.SPECIAL CONSIDERATIONS
On color monitors, the Control Manager automatically draws controls so that they match the colors of the controls used by system software. Be aware that nonstandard colors in your controls may initially confuse your users.When you create a control color table record, your application should not deallocate it if another control is still using it.