In today’s advance learning tutorial you will learn how to
print a string or your name in graphics mode.
In graphics mode, for printing any text on the output
screen, we have a function called outtextxy().
Prototype of outtextxy:-
Outtextxy(int x,int y, “Your text” );
This function works only in graphics mode.Here x and y points the position of the printed text and in
third parameter we will pass text which we want to print on the screen.
Example:-
Outtextxy(10,10,”Welcome In Advance Learning Tutorial”);
The function outtextxy uses the current font style , current
font size and current direction of the character.
To set all the above properties of the text we use
settextstyle() function.
Prototype of settextstyle:-
Settextstyle(int font,int direction, int charsize);
This function sets the font style, direction of text and
character size.But always remember the function settextstyle should be
called prior to the outtextxy function otherwise it will not work and the
output remains same.
The graphics system of C++ environment supports 8x8 bit
mapped font system.
Direction:-
This supports 2 types of mode
- Horizontal text ( left to right)
- Vertical text (bottom to up)
By default mode of direction is set horizontal direction.
To change the mode we can pass the value 0 (zero) for
horizontal direction and 1 for vertical direction.
Charsize:-
It is also an integer value. We can increase the size of
text 10 times. Starting value is 0.
Example:-
settextstyle(8,0,3);
setcolor("YELLOW");
outtextxy(150,180,"Programming world");
Thank you for reading this topic if you have any doubt or any confusion regarding this topic so you can freely ask your question in comment box. And don’t forget to like our facebook page.
No comments:
Post a Comment