How to: Display and Print Source Code in Color
You can display and print code with color syntax in the Command window and Visual FoxPro editors for program (.prg) files, methods, stored procedures, and memos.
The following sections contain more information about displaying and printing code in color:
Displaying Source Code in Color
Printing Source Code in Color
Displaying Source Code in Color
You can turn on syntax coloring separately for each editing window; however; the color syntax settings that you choose in the Editor tab of the Options dialog box apply to the Command window and most other editing windows. For more information, see Editor Tab, Options Dialog Box and Editing Window.
Note
To display color syntax in run-time applications, Visual FoxPro must be configured to display color syntax. Run-time applications display only the default color settings because run-time applications do not check the Windows registry for settings that you change in the Options dialog box, which specifies the default settings for color syntax.
When color syntax is turned on, Visual FoxPro performs background compilation for the current and single line of code that you are typing. When a line of code contains invalid syntax, Visual FoxPro displays the line of code with the selected formatting style.
To display color syntax in an editing window
Open the editing window that you want to display color syntax.
On the Edit menu, choose Properties.
In the Edit Properties dialog box, select the Syntax coloring check box.
Click OK.
Syntax coloring is activated for the editing window you selected. For more information, see Edit Properties Dialog Box.
You can also display source code files to the screen in color using the TYPE command. For more information, see TYPE Command.
To customize color syntax settings
On the Tools menu, choose Options.
In the Options dialog box, choose the Editor tab.
Under Syntax color settings, choose the color settings that you want.
When you are finished choosing settings, click OK.
The color settings you chose take effect.
To set formatting for invalid color syntax
Turn on syntax coloring for the editing window.
On the Tools menu, choose Options.
In the Options dialog box, choose the Editor tab.
In the Background Compile box, choose the formatting style you want.
Invalid syntax displays in the editing window with the formatting style you chose.
Printing Source Code in Color
You can print source code in color wherever color syntax appears, such as program files, methods, stored procedures, and memos.
Note
To print your code files in color, you must be connected to a color printer to select the color printing options available for your printer. Background colors set in the Editor tab of the Options dialog box are not printed. If you select color printing for source code files, hyperlinks appear underlined.
To print source code in color
Open the program file or code you want to print.
On the File menu, choose Print.
In the Print dialog box, choose your color printer, and then click Preferences.
Select the color printing options available for your printer.
When you are finished, click Print.
When connected to a color printer, you can also print source code in color using the TYPE command with the TO PRINTER clause.
For more information, see Print Dialog Box (Visual FoxPro) and TYPE Command.
See Also
Tasks
How to: View and Change Environment Settings