graphdefaults function in c using graphics.h

  • برمجة سي c

graphdefaults function in c using graphics.h

graphdefaults function resets all graphics settings to their defaults.

Declaration: void graphdefaults();

It resets the following graphics settings :-

  • Sets the viewport to the entire screen.
  • Moves the current position to (0,0).
  • Sets the default palette colors, background color, and drawing color.
  • Sets the default fill style and pattern.
  • Sets the default text font and justification.

الأجوبة

#include <graphics.h>
#include <conio.h>

main()
{
   int gd = DETECT, gm;

   initgraph(&gd, &gm, "C:\\TC\\BGI");

   setcolor(RED);
   setbkcolor(YELLOW);

   circle(250, 250, 50);

   getch();
   graphdefaults();

   getch();
   closegraph();
   return 0;
}

In the above program we have first changed the drawing color to RED and background color to YELLOW and then drawn a circle with (250, 250) as center and 50 as radius. When the user will press a key graphdefaults is called and both drawing and background color will be reset to their default values i.e. 

هل كان المحتوى مفيد؟

القوائم الدراسية التي ينتمي لها السؤال

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...