V.I.P FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.
HELLO, Visitor

Tutorial Lesson Part II -

Go down

Tutorial Lesson Part II -  Empty Tutorial Lesson Part II -

Post by winda Fri Oct 14, 2011 11:52 pm

To change the color of the text printed on the screen we use the TextColor command.
program Colors;

uses
crt;

begin
TextColor(Red);
Writeln('Hello');
TextColor(White);
Writeln('world');
end.
The TextBackground command changes the color of the background of text. If you want to change the whole screen to a certain color then you must use ClrScr.
program Colors;

uses
crt;

begin
TextBackground(Red);
Writeln('Hello');
TextColor(White);
ClrScr;
end.
Screen coordinates

You can put the cursor anywhere on the screen using the GoToXY command. In DOS, the screen is 80 characters wide and 25 characters high. The height and width varies on other platforms. You may remember graphs from Maths which have a X and a Y axis. Screen coordinates work in a similar way. Here is an example of how to move the cursor to the 10th column in the 5th row.
program Coordinates;

uses
crt;

begin
GoToXY(10,5);
Writeln('Hello');
end.
Windows

Windows let you define a part of the screen that your output will be confined to. If you create a window and clear the screen it will only clear what is in the window. The Window command has 4 parameters which are the top left coordinates and the bottom right coordinates.
program Coordinates;

uses
crt;

begin
Window(1,1,10,5);
TextBackground(Blue);
ClrScr;
end.
Using window(1,1,80,25) will set the window back to the normal size.
Sound

The Sound command makes a sound at the frequency you give it. It does not stop making a sound until the NoSound command is used. The Delay command pauses a program for the amount of milliseconds you tell it to. Delay is used between Sound and NoSound to make the sound last for a certain amount of time.
program Sounds;

uses
crt;

begin
Sound(1000);
Delay(1000);
NoSound;
end.
winda
winda
Calon Penduduk Cyber
Calon Penduduk Cyber

Jumlah posting : 19
Points : 4620
Reputation : 4
Join date : 14.10.11

http://www.cyber.forum-canada.com

Kembali Ke Atas Go down

Kembali Ke Atas

- Similar topics

 
Permissions in this forum:
Anda tidak dapat menjawab topik