[C] 将所有图形设置复位为它们的缺省值 →→→→→进入此内容的聊天室

来自 , 2020-02-16, 写在 C, 查看 99 次.
URL http://www.code666.cn/view/2d3acd3e
  1. #include <graphics.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <conio.h>
  5.  
  6. int main(void)
  7. {
  8.    /* request auto detection */
  9.    int gdriver = DETECT, gmode, errorcode;
  10.    int maxx, maxy;
  11.  
  12.    /* initialize graphics and local variables */
  13.    initgraph(&gdriver, &gmode, "c:\\bor\\Borland\\bgi");
  14.  
  15.    /* read result of initialization */
  16.    errorcode = graphresult();
  17.    if (errorcode != grOk)  /* an error occurred */
  18.    {
  19.       printf("Graphics error: %s\n", grapherrormsg(errorcode));
  20.       printf("Press any key to halt:");
  21.       getch();
  22.       exit(1); /* terminate with an error code */
  23.    }
  24.  
  25.    maxx = getmaxx();
  26.    maxy = getmaxy();
  27.  
  28.    /* output line with non-default settings */
  29.    setlinestyle(DOTTED_LINE, 0, 3);
  30.    line(0, 0, maxx, maxy);
  31.    outtextxy(maxx/2, maxy/3, "Before default values are restored.");
  32.    getch();
  33.  
  34.    /* restore default values for everything */
  35.    graphdefaults();
  36.  
  37.    /* clear the screen */
  38.    cleardevice();
  39.  
  40.    /* output line with default settings */
  41.    line(0, 0, maxx, maxy);
  42.    outtextxy(maxx/2, maxy/3, "After restoring default values.");
  43.  
  44.    /* clean up */
  45.    getch();
  46.    closegraph();
  47.    return 0;
  48. }
  49.  

回复 "将所有图形设置复位为它们的缺省值"

这儿你可以回复上面这条便签

captcha