BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Institute of Computing > Bachelor of Science in Information Technology > BsIT 2nd Semester > Object Oriented Programming


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 01-03-2011, 03:02 PM
bonfire's Avatar
M.Arsalan Qureshi

 
Join Date: Oct 2008
Location: Garden Town, Multan Cantt
Posts: 616
Program / Discipline: BSTS
Class Roll Number: 09-31
bonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond reputebonfire has a reputation beyond repute
Default Program to write in different fonts on the screen

Program to write in different fonts on the screen


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

void main (int)
{
int gdriver=DETECT,gmode,errorcode; //Requesting auto-detection.
int midx,midy,fstyle;
//Initializing graphics and local variables.
initgraph(&gdriver,&gmode,"d:\\bc3\\bgi");
//Reading result of initialization.
errorcode=graphresult();
if(errorcode!=grOk)
//An error occurred.
{
printf("Graphics error occurred : %s \n",grapherrormsg(errorcode));
printf("Press any key to stop : ");
getch();
exit(1); //Terminate the program due to error.
}
//Changing the font styles using a loop.
cleardevice();
settextstyle(DEFAULT_FONT,HORIZ_DIR,4);
/*The above statement means that it is the default font in the horizontal
direction and the font size is 4.*/
//Outputting a message.
outtextxy(200,200,"Default font");
getch();
cleardevice();
settextstyle(TRIPLEX_FONT,VERT_DIR,5);
/*The above statement means that it is the triplex font in the vertical
direction and the font size is 5.*/
//Outputting a message.
outtextxy(200,200,"Triplex font");
getch();
cleardevice();
settextstyle(GOTHIC_FONT,HORIZ_DIR,5);
/*The above statement means that it is the default font in the horizontal
direction and the font size is 2.*/
//Outputting a message.
outtextxy(200,200,"Gothic font");
getch();
cleardevice();
settextstyle(SMALL_FONT,VERT_DIR,5);
/*The above statement means that it is the small font in the vertical
direction and the font size is 5.*/
//Outputting a message.
outtextxy(200,200,"Small font");
getch();
cleardevice();
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,5);
/*The above statement means that it is the sans serif font in the horizontal
direction and the font size is 5.*/
//Outputting a message.
outtextxy(200,200,"Sans Serif font");
getch();
closegraph();
}
This graphics program switches between default font, triplex font, gothic font, small font and sans serif font using the 'settextstyle' command.
__________________

Reply With Quote
Reply

Tags
fonts, program, screen, write


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write C# student program using grade code thecool Visual Programming 0 17-06-2011 09:53 PM
Program to change the foreground colors and draw circles on the screen bonfire Object Oriented Programming 0 01-03-2011 03:01 PM
Program to change the background colors on the screen bonfire Object Oriented Programming 0 01-03-2011 03:00 PM
write a program to input visiting and perment employee record by insertion extertion arslanbadar BsCS 3rd Semester 0 06-11-2008 07:25 PM

Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 12:19 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.