Monday, 2024-05-06, 10:26 PM

Welcome Guest | RSS

MainRegistrationLogin
Qbasic Home

Catalog categories
Qbasic Tutorial [31]

Rate my Site
Rate JPSor Site
Total of answers: 168

Main » Articles » Qbasic Tutorial

Chapter 15 - Qbasic Tutorial

Tired of all this black and white? Then the COLOR statement is for you. Try this program for size:

 CLS
COLOR 2, 0
PRINT "That's ";
COLOR 3, 0
PRINT "more ";
COLOR 5, 0
PRINT "like it!"

Color takes two numbers. The first number is the foreground color. The second number is the background color. For example, if you want to print black on white instead of white on black, use "COLOR 0,7". The colors each have their own number:

  • 0 - Black
  • 1 - Blue
  • 2 - Green
  • 3 - Cyan
  • 4 - Red
  • 5 - Magenta
  • 6 - Yellow
  • 7 - White

There are plenty of other colors too. Try the numbers from 8 through 15 to see what colors you get. Basically, if you add 8 to any of the above colors, you get brighter versions of the same color. Take blue which is 1 and add 8 and you get 9 which is bright blue.

Blinking

Adding 16 to a color number gives you a blinking version. This doesn't work in a DOS window, though. Press <ALT><ENTER> to switch to full-screen mode which will show the blinking. Try this program:

 CLS
COLOR 28, 0
PRINT "*** WARNING ***"
COLOR 15, 0
PRINT "Programming can be too much fun!"

Color can be used in many ways to make your programs more interesting.



Source: http://jpsor.ucoz.com
Category: Qbasic Tutorial | Added by: JPSor (2009-02-26) | Author: JPSor
Views: 1550 | Rating: 4.0/1 |
Login

Qbasic Clock

Search

Visit my Friends

Who's Online

Total online: 1
Guests: 1
Resgistered: 0


Copyright MyCorp © 2024