How to set font style color and bg color;

the online examples are very tough ;

can ayone give me a easy and understandable code ??

Recommended Answers

All 10 Replies

no...... I,ve had many of these examples.... I don't get how the give output.

Graphic or text mode?

text..... me just a begineer

What is oyur OS and compiler?

OS vista ultimate compiler tcc v.3.0 graphics card iintel 950 GMA.

Use outtextxy() to give the output at the specific locations given by the coordinates x,y. Its right there in the examples in the links I provided.

When in graphic mode, the screen is divided into coordinates. You set pixel values, add text, add graphics (circles, lines etc) by using the coordinates.

I don't know any thing both x,y .... thats why I prefer goto over gotoxy.

hang on......... what does graphics mode or text mode mean ??? that my prog. is text based or graphics based isn;t it ?

The top left corner of your monitor correspondes to (0,0) i.e at that pixel

x=0 and y=0

on moving right horizontally x increases and on moving down vertically y increases.

You can get the rightmost point of the screen by using the function

int x= getmaxx()

and the bottom most points by using

int y=getmaxy()

remember that each point on the screen is defined by both x and y togther.

Assuming that the rightmost and the bottom most points are 640 and 480 respectively. The location of the center pixel will be

x=320
y=240
which is represented as (320,240).

You can draw a circle with this point as the center or display text starting from this point. Usually if you want to display graphics (text, shapes or anything else) you can do it either by

1. Hit and trial : keep changing the values of x and y till you get the right result or

2. Use some mathematical relationship between the shapes.

I suggest you copy a program and see how the output changes when you change the x and y coordinates.
Try the code given on this page
http://www.cs.colorado.edu/~main/cs1300/doc/bgi/line.html
see how the line changes. when you change the parameters for the function line()

Also you might want to check this out.
http://www.cs.colorado.edu/~main/cs1300/doc/bgi/index.html
or refer to the help of TC.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.