Function Name: setvisualpage
Function: Set the visible graphic page number
Usage: void far setvisualpage (int pagenum);
program Example:
#include
#include
#include
#include
int main (void)
{
/* Select a driver and mode that supports * *
/* Multiple pages. */
int gdriver = EGA, Gmode = Egahi, errorcode;
int x, y, HT;
/* Initialize graphics and local variables * *
Initgraph (&gdriver, &gmode, "");
/* Read result of initialization * *
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 * *
}
x = Getmaxx ()/2;
y = Getmaxy ()/2;
HT = TextHeight ("W");
/* Select the off screen page for drawing * *
Setactivepage (1);
/* Draw a line on page #1 * *
Line (0, 0, Getmaxx (), Getmaxy ());
/* Output a message on page #1 * *
Settextjustify (Center_text, Center_text);
Outtextxy (x, Y, "This is page #1:");
Outtextxy (x, Y+ht, "Press any key to halt:");
/* Select drawing to Page #0 * *
Setactivepage (0);
/* Output a message on page #0 * *
Outtextxy (x, Y, "This is page #0.");
Outtextxy (x, Y+ht, "Press any key to view page #1:");
Getch ();
/* Select Page #1 as the visible page * *
Setvisualpage (1);
/* Clean up/*
Getch ();
Closegraph ();
return 0;
}