11.1.3 Standardizing colors with ColorSchemes

Standardizing colors with ColorSchemes

An alternative to setting the colors on the SlideMaster is to use a ColorScheme object, which stores the colors for the eight standard elements on a slide. Figure 5 shows the PowerPoint dialog box that allows you to customize the colors. To display it in PowerPoint, select Format|Slide Color Scheme from the menu, then click the Custom tab. Up to 16 ColorScheme objects can exist; they re stored in the ColorSchemes collection.

Figure 5. PowerPoint s Color Scheme dialog box. Color schemes set the eight standard colors for objects.

Although the ColorSchemes collection belongs to the Presentation object, any ColorScheme object can be referenced by the SlideMaster object, or by any slide. The Help file has quite a lengthy discussion of how to use multiple ColorSchemes within a presentation (for example, having one ColorScheme for title slides, and another for standard slides).

The most basic and practical use of a single ColorScheme is to dictate the colors of the eight elements on the SlideMaster. A ColorScheme contains a collection of eight colors, each referenced by a constant. The constants for the eight colors are: ppBackground (1), ppForeground (2), ppShadow (3), ppTitle (4), ppFill (5), ppAccent1 (6), ppAccent2 (7), and ppAccent3 (8). Beware: setting the background and fill colors in a ColorScheme overrides any of the Background or Fill object properties that are set if you set up a gradient fill background, do not set the background color of the color scheme!

The following code changes the title colors to red and the text (ppForeground) to dark blue. Be sure to use this code instead of setting colors in the SlideMaster. Colors set explicitly through the SlideMaster s TextStyles will take precedence over the ColorSchemes (though if you look at the dialog box, the ColorSchemes color will change, but it won t change the colors on the slides).

#DEFINE ppTitle 4

#DEFINE ppForeground 2

#DEFINE rgbRed RGB(255, 0, 0)

#DEFINE rgbDarkBlue RGB( 0, 0, 128)

WITH oPresentation.SlideMaster.ColorScheme

.Colors[ppTitle].RGB = rgbRed

.Colors[ppForeground].RGB = rgbDarkBlue

ENDWITH

 

Copyright 2000 by Tamar E. Granor and Della Martin All Rights Reserved



Microsoft Office Automation with Visual FoxPro
Microsoft Office Automation with Visual FoxPro
ISBN: 0965509303
EAN: 2147483647
Year: 2000
Pages: 128

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net