Coleur texte et fond d'écrant texte

cs_cognac Messages postés 50 Date d'inscription samedi 20 avril 2002 Statut Membre Dernière intervention 11 mars 2010 - 27 juin 2002 à 19:27
cs_cognac Messages postés 50 Date d'inscription samedi 20 avril 2002 Statut Membre Dernière intervention 11 mars 2010 - 1 juil. 2002 à 16:33
Voici une partie de mon programme (ça provient d'un excellent tut.). Mais je suis incapable de coloré le texte et le «fond d'écrant texte» en même temps. Je ne peux que faire un ou l'autre. Si je tente de faire les deux alors le lettrage apparaît en blanc.

Merci d'avance
cognac

#include
#include <stdio.h>
#include <conio.c>
#include <ctype.h>

void screeninit();

void screeninit()
{
textbackground(1);
textcolor(14);
cout <<"Ca fonctionne";
getch();
}
void main()
{
screeninit();
}

2 réponses

cmarsc Messages postés 455 Date d'inscription mercredi 6 mars 2002 Statut Membre Dernière intervention 18 décembre 2003
1 juil. 2002 à 09:48
Salut,

si tu utilises devc++ tu dois employer textcolor.
tu peux faire les 2 choses en même temps :
voici les codes couleurs :
textcolor(206),textcolor(155)...
taper un nombre entre 0 et 256

#include <stdio.h>
#include <conio.c>

int main()
{

int i1;
int col = 5;
int ligne = 0;
char clav;

col = 1;
ligne = 0;
textcolor (206);
gotoxy(22, 3);
cprintf (" LA PALETTE DES 256 COULEURS DEV C++4 ");
for (i1 = 0; i1 < 257;i1++) {

(ligne == 16) ? col +=5 , ligne = 0 : col, ligne++;
gotoxy(1 + col, 4 + ligne);
if (i1 == 0)
textcolor (15); // le zero = noir
else
textcolor (i1);

cprintf ("%-3d", i1);

}

clav = getch();

return 0;
}
0
cs_cognac Messages postés 50 Date d'inscription samedi 20 avril 2002 Statut Membre Dernière intervention 11 mars 2010
1 juil. 2002 à 16:33
Merci beaucoup,

Ca fonctionne très bien,

Cognac :)
0
Rejoignez-nous