PRODUCT : Borland C++ NUMBER : 1727 VERSION : All OS : DOS DATE : October 25, 1993 PAGE : 1/2 TITLE : Erasing test in a BGI Application A common question with BGI users is how to erase text from the screen. This is a very simple process, but not obvious at first. It is done by changing the drawing color to the background color, then redrawing the same text again. Below is a sample program that demostrates how this works. The key to this process is: setcolor(getbkcolor()). One line determines the background color and sets the drawing color to it. #include #include #include #include int main(void) { int gdriver = DETECT, gmode, errorcode; int midx, midy; initgraph(&gdriver, &gmode, "\\bc\\bgi"); errorcode = graphresult(); if (errorcode != grOk) // an error occurred { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); // terminate with an error code } midx = getmaxx() / 2; midy = getmaxy() / 2; moveto(midx, midy); //----------------------------------------------- output text outtext("This "); outtext("is "); outtext("a "); outtext("test."); getch(); //---------------------------- move back to original position moveto(midx, midy); //--------------------- set drawing color to background color PRODUCT : Borland C++ NUMBER : 1727 VERSION : All OS : DOS DATE : October 25, 1993 PAGE : 2/2 TITLE : Erasing test in a BGI Application setcolor(getbkcolor()); //-------------------------------- output the same text again outtext("This "); outtext("is "); outtext("a "); outtext("test."); getch(); closegraph(); return 0; } DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.