Applies To ActiveX control, Bound Object Frame control, Chart control, Command Button control, Image control, Toggle Button control, Unbound Object Frame control.
Description
The ObjectPalette property specifies the palette in the application used to create:
Setting
Microsoft Access sets the value of the ObjectPalette property to a String data type containing the palette information. You can use this setting to set the value of the PaintPalette property for a form or report.
For the following objects, views, and controls, the ObjectPalette property setting is read-only. This property setting is unavailable for these controls in other views.Object | View | Control |
Forms | Form Design view and Form view | Command button, chart, image control, toggle button, and unbound object frame. |
Form view | Bound object frame. | |
Reports | Report Design view | Command button, chart, image control, toggle button, and unbound object frame. This property setting is unavailable for a bound object frame in all views on a report. |
See Also PaintPalette property, PaletteSource property, Picture property.
Example The following example sets the PaintPalette property of the Seascape form to the ObjectPalette property of the Ocean control on the DisplayPictures form. (Ocean can be a bound object frame, command button, chart, toggle button, or unbound object frame.)Forms!Seascape.PaintPalette = Forms!DisplayPictures!Ocean.ObjectPalette
The ObjectPalette and PaintPalette properties are useful for programmatically altering the color palette in use by an open form at run time. A common use of these properties is to set the current form's PaintPalette property to the palette of a graphic displayed in a control that has the focus.
For example, you can have a form with an ocean picture, showing many shades of blue, and a sunset picture, showing many shades of red. Since Windows only allows one color palette active at a time, one picture will look much better than the other. The following example uses a control's Enter event for setting the form's PaintPalette property to the control's ObjectPalette property so the graphic that has the focus will have an optimal appearance.
Sub OceanPicture_Enter()
Me.PaintPalette = Me!OceanPicture.ObjectPalette
End Sub
Sub SunsetPicture_Enter()
Me.PaintPalette = Me!SunsetPicture.ObjectPalette
End Sub