Settextstyle function in c using graphics.h

  • برمجة سي c

Settextstyle function in c using graphics.h

Settextstyle function is used to change the way in which text appears, using it we can modify the size of text, change direction of text and change the font of text.

Declaration: void settextstyle( int font, int direction, int charsize);
font argument specifies the font of text, Direction can be HORIZ_DIR (Left to right) or VERT_DIR (Bottom to top).

Different fonts

enum font_names
{
   DEFAULT_FONT,
   TRIPLEX_FONT,
   SMALL_FONT,
   SANS_SERIF_FONT,
   GOTHIC_FONT,
   SCRIPT_FONT,
   SIMPLEX_FONT,
   TRIPLEX_SCR_FONT,
   COMPLEX_FONT,
   EUROPEAN_FONT,
   BOLD_FONT
};

الأجوبة

#include <graphics.h>
#include <conio.h>
 
main()
{
   int gd = DETECT, gm, x = 25, y = 25, font = 0;
   
   initgraph(&gd,&gm,"C:\\TC\\BGI");
 
   for (font = 0; font <= 10; font++)
   {
      settextstyle(font, HORIZ_DIR, 1);
      outtextxy(x, y, "Text with different fonts");
      y = y + 25;
   }
 
   getch();
   closegraph();
   return 0;
}
هل كان المحتوى مفيد؟

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

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

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