How to Use Custom Colors in Screen or Report Rectangles

Last reviewed: April 30, 1996
Article ID: Q111914
The information in this article applies to:
  • Microsoft FoxPro for Macintosh, version 2.5b
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b

SUMMARY

The Fill Color and Pen Color options on the Object menu offer you a selection of 16 predefined colors for rectangles and rounded rectangles. Occasionally, you may need to use a color that is not on this predefined list. For example, the lightest shade of gray offered may print out too dark when used to fill a rectangle on a Hewlett-Packard (HP) LaserJet printer. In this case, you can use custom colors to fill or outline a rectangle or rounded rectangle/ellipse object.

MORE INFORMATION

When a screen or report is created, each object is stored as a single record in a database. You can edit this database to insert color values not available through the menu options.

To modify a screen rectangle

  1. In the Command window, issue the following command:

          CREATE SCREEN color
    

  2. Add a rectangle with square corners to the screen. From the Object menu, choose Fill, and select the solid fill pattern. From the Object menu, choose Fill Color, and select any color other than white.

  3. Double-click the rectangle and add the words "Square Rectangle" in the comment. Choose OK.

  4. Add a rounded rectangle to the screen. From the Object menu, choose Fill, and select the solid fill pattern. From the Object menu, choose Fill Color, and select any color other than white.

  5. Double-click the rectangle and add the words "Rounded Rectangle" in the comment. Choose OK.

  6. Close the screen. In the Command window, type the following commands:

          USE color.scx
          BROWSE
    

    Note that there are two records with a value of 7 in the OBJTYPE field. These two records contain the information for the rectangle objects added earlier. The COMMENT field contains the comment added to assist in identifying a particular rectangle.

    The following fields contain information concerning the color of the object. There are two sets of fields, one for the pen color of the outline, and one for the fill color. Each field contains a single value for the red, green, or blue component of an RGB value.

          Field      Controls
          -----------------------------------------------------
    
          PENRED     Red component of outline color RGB value
          PENGREEN   Green component of outline color RGB value
          PENBLUE    Blue component of outline color RGB value
          FILLRED    Red component of fill color RGB value
          FILLGREEN  Green component of fill color RGB value
          FILLBLUE   Blue component of fill color RGB value
    
    

  7. Modify the FILLRED, FILLGREEN, and FILLBLUE values slightly, making sure that each remains in the range of 0 through 255.

  8. In the Command window, close the .SCX file as a database and reopen it as a screen by typing the following commands:

          USE
          MODIFY SCREEN color
    

Note that the rectangle color has changed to a custom value.

To modify a report rectangle

  1. In the Command window, issue the following command:

          CREATE REPORT color
    

  2. Add a rectangle with square corners to the report. From the Object menu, choose Fill, and select the solid fill pattern. From the Object menu, choose Fill Color, and select any color other than white.

  3. Double-click the rectangle and add the words "Square Rectangle" in the comment. Choose OK.

  4. Add a rounded rectangle to the report. From the Object menu, choose Fill, and select the solid fill pattern. From the Object menu, choose Fill Color, and select any color other than white.

  5. Double-click the rectangle and add the words "Rounded Rectangle" in the comment. Choose OK.

  6. Close the report. In the Command window, issue the following commands:

          USE color.frx
          BROWSE
    

    Note that there are two records with a value of 7 in the OBJTYPE field. These two records contain the information for the rectangle objects added earlier. The COMMENT field contains the comment added to assist in identifying a particular rectangle.

    The following fields contain information concerning the color of the object. There are two sets of fields, one for the pen color of the outline, and one for the fill color. Each field contains a single value for the red, green, or blue component of an RGB value.

          Field      Controls
          -----------------------------------------------------
    
          PENRED     Red component of outline color RGB value
          PENGREEN   Green component of outline color RGB value
          PENBLUE    Blue component of outline color RGB value
          FILLRED    Red component of fill color RGB value
          FILLGREEN  Green component of fill color RGB value
          FILLBLUE   Blue component of fill color RGB value
    
    

  7. Modify the FILLRED, FILLGREEN, and FILLBLUE values slightly, making sure that each remains in the range of 0 through 255.

  8. In the Command window, close the .FRX file as a database and reopen it as a report by typing the following commands:

          USE
          MODIFY REPORT color
    

Note that the rectangle color has changed to a custom value.

REFERENCES

For more information about .SCX and .FRX table structures, refer to the FoxPro for Windows or FoxPro for Macintosh "Developer's Guide" appendixes.


Additional reference words: FoxMac FoxWin 2.50 2.50a 2.50b
KBCategory: kbprg
KBSubcategory: FxprgBrowse


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 30, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.