Microsoft KB Archive/88990

= Microsoft Knowledge Base =

FastTips for Visual Basic for MS-DOS: Graphics Q&A
Last reviewed: December 2, 1996

Article ID: Q88990

SUMMARY
Microsoft Technical Support Application Note (Text File) DV0601: GRAPHICS QUESTIONS AND ANSWERS Revision Date: 8/92 No Disk Included The following information applies to Microsoft Visual Basic for MS-DOS version 1.0.


 * INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY   |
 * ACCOMPANY THIS DOCUMENT (collectively referred to as an           |
 * Application Note) IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY     |
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO   |
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A    |
 * PARTICULAR PURPOSE. The user assumes the entire risk as to the    |
 * accuracy and the use of this Application Note. This Application   |
 * Note may be copied and distributed subject to the following       |
 * conditions: 1) All text must be copied without modification and   |
 * all pages must be included; 2) If software is included, all files |
 * on the disk(s) must be copied without modification [the MS-DOS(R) |
 * utility DISKCOPY is appropriate for this purpose]; 3) All         |
 * components of this Application Note must be distributed together; |
 * and 4) This Application Note may not be distributed for profit.   |
 * Copyright 1992 Microsoft Corporation. All Rights Reserved.        |
 * Microsoft and MS-DOS are registered trademarks and Visual Basic   |
 * and Windows are trademarks of Microsoft Corporation.              |
 * and Windows are trademarks of Microsoft Corporation.              |

1. Q. When I print from within a forms module, nothing happens. What is causing this problem?

A. All output to a graphics screen should be done from a nonforms module (a .BAS file). This is because any PRINT or CLS command in a forms module defaults to the PRINT or CLS method, which makes it appear as if the PRINT or CLS command is ignored; however, the command is actually executed on your invisible form.

For more information on graphics and printing to the desktop, please refer to Chapters 11 and 18 of the &quot;Programmer's Guide.&quot;

2. Q. How can I display graphics in conjunction with a form?

A. Microsoft Visual Basic for MS-DOS event-driven forms are available in text mode only. A form cannot be displayed on the screen in conjunction with graphics. To display graphics in a     forms program, you must hide the screen using SCREEN.HIDE before you enter graphics mode. After the form or forms are hidden, a     graphics SCREEN statement can be executed.

All output to a graphics screen should be done from a nonforms module (a .BAS file). This is because any PRINT or CLS command in a forms module defaults to the PRINT or CLS method, which makes it appear as if the PRINT or CLS command is ignored; however, the command is actually executed on your invisible form.

When you are ready to return your program to forms mode, you must execute a SCREEN zero statement. A graphics screen with 40- by-25 line mode also requires a WIDTH 80 statement before the program reenters forms mode.

3. Q. How do I get more than one background color for text in a     graphics mode?

A. Graphic screen modes differ from text screen modes in that there is only one background color. Therefore, by default it is not possible to have more than one color surrounding your text. You can work around this limitation with the Presentation Graphics Toolkit provided with Microsoft Visual Basic for MS-DOS Professional Edition. You can also work around this limitation by using Get and Put commands.

For more information on the Presentation Graphics Toolkit, please refer to Chapter 5 of the &quot;Professional Features&quot; guide provided with Visual Basic for MS-DOS Professional Edition. Presentation graphics are not provided with the standard version of Visual Basic for MS-DOS.

An example of using the Get and Put commands is available in the Microsoft Technical Support (MTS) Help file. To access the MTS Help file, perform the following steps in either the standard or the professional edition of Visual Basic for MS-DOS:

Step 1. Start Visual Basic for MS-DOS.

Step 2. From the Help menu, choose Contents. Or, hold down the ALT key, press H to open the Help menu, then press C to open the Contents screen.

Step 3. Choose the Microsoft Technical Support topic at the top of     the screen.

Step 4. Next, choose the Knowledge Base Contents topic at the top of the screen to display a list of all Microsoft Knowledge Base topics.

Step 5. Under the Graphics topic, choose the article titled &quot;Colors - 16 Foreground/Background Colors Simultaneously.&quot; The example is at the end of this article.

4. Q. Can .PCX files be read directly with Microsoft Visual Basic for MS-DOS?

A. Visual Basic for MS-DOS cannot read .PCX files directly. A     shareware utility that can convert .PCX images to BLOAD and BSAVE formats, which Basic programs can read, is available. This utility is called PICEM.

An example of using PICEM with Visual Basic for MS-DOS is     available in the MTS Help file. To access the MTS Help file, use the following steps:

Step 1. Start Visual Basic for MS-DOS.

Step 2. From the Help menu, choose Contents. Or, hold down the ALT key, press H to open the Help menu, then press C to open the Contents screen.

Step 3. Choose the Microsoft Technical Support topic at the top of     the screen.

Step 4. Next, choose the Knowledge Base Contents topic at the top of the screen to display a list of all Microsoft Knowledge Base topics.

Step 5. Under the Graphics topic, select either of the following articles: &quot;Save Color Registers after B-SAVE of PICEM Graphics&quot; or &quot;Use PICEM to View .PCX/.PIC/.GIF Files.&quot; These articles provide examples of how you can use PICEM.

5. Q. Can I print graphics to a printer?

A. Microsoft Visual Basic for MS-DOS does not include the capability to print graphics directly to a printer. With the GRAPHICS.COM utility provided with Microsoft MS-DOS versions 4.0 and 5.0, a graphics screen can be printed on many printers by     simultaneously pressing the SHIFT key and the PRINT SCREEN key.

An example of how to print graphics images to an Epson- compatible line printer is provided in the MTS Help file. To     access the MTS Help file, use the following steps:

Step 1. Start Visual Basic for MS-DOS.

Step 2. From the Help menu, choose Contents. Or, hold down the ALT key, press H to open the Help menu, then press C to open the Contents screen.

Step 3. Choose the Microsoft Technical Support topic at the top of     the screen.

Step 4. Next, choose the Knowledge Base Contents topic at the top of the screen to display a list of all Microsoft Knowledge Base topics.

Step 5. Under the Graphics topic, select the article titled &quot;Print Screens to Epson Printer.&quot; The example is at the end of     this article.

6. Q. How do I use BLOAD and BSAVE with graphics screens?

A. An example of how to use BLOAD and BSAVE with graphics screens is found in the MTS Help file provided with Microsoft Visual Basic for MS-DOS. To access the MTS Help file, use the following steps:

Step 1. Start Visual Basic for MS-DOS.

Step 2. From the Help menu, choose Contents. Or, hold down the ALT key, press H to open the Help menu, then press C to open the Contents screen.

Step 3. Choose the Microsoft Technical Support topic at the top of     the screen.

Step 4. Next, choose the Knowledge Base Contents topic at the top of the screen to display a list of all Microsoft Knowledge Base topics.

Step 5. Under the Graphics topic, choose the article titled &quot;BSAVE/BLOAD EGA/VGA Screens, Complete Instructions.&quot; The example is at the end of this article.