#include <conio.h>
#include <stdio.h>
main()
{
int i;
char *s[]={"BLACK","BLUE","GREEN","CYAN","RED","MAGENTA","BROWN","LIGHTGRAY"};
textmode(C80);
textbackground(0);
clrscr();
for(i=1;i<8;i++)
{
window(10+i*5,5+i,30+i*5,15+i);
textbackground(i);
clrscr();
textcolor(7+i);
if(i%2==0)
highvideo();
else
lowvideo();
cputs(s[i]);
}
getch();
}
structtext_info(
unsigned char winleft;
unsigned char wintop;
unsigned char winright;
unsigned char winbottom;
unsigned char attributes;
unsigned char normattr;
unsigned char currmode;
unsigned char screenheight;
unsigned char screenwidth;
unsigned char curx;
unsigned char cury;
};
printf("The cursor is at %d,%d\n",wherex(),wherey());
#include <stdio.h>
#include <conio.h>
#include <bios.h>
char leftbuf[40*25*2];
char rightbuf[40*25*2];
int leftx,lefty;
int rightx,righty;
void draw_left_win();
void draw_right_win();
int main()
{
int key;
int turn;
textmode(C80);
textbackground(0);
textcolor(WHITE);
clrscr();
gotoxy(60,1);
cprintf("Press Esc to Quit");
window(41,2,79,24);
textbackground(2);
textcolor(14);
clrscr();
gettext(41,2,79,24,rightbuf);
window(2,2,40,24);
textbackground(1);
textcolor(15);
clrscr();
gettext(2,2,40,24,leftbuf);
turn=1;
for(;;)
{
key=bioskey(0);
if(key==0x011b)
exit(0);
key=key&&0xff;
if(key=='\t')
{
if(turn==1)
{
gettext(2,2,40,24,leftbuf);
leftx=wherex();
lefty=wherey();
draw_right_win();
turn=0;
}
else if(turn==0)
{
gettext(41,2,79,24,rightbuf);
rightx=wherex();
righty=wherey();
draw_left_win();
turn=1;
}
else
putch(key);
}
}
void draw_right_win()
{
window(41,2,79,24);
textbackground(2);
textcolor(14);
clrscr();
puttext(41,2,7,24,rightbuf);
gotoxy(rightx,righty);
}
void draw_left_win()
{
window(22,40,24);
textbackground(1);
textcolor(15);
clrscr();
puttext(2,2,40,24,leftbuf);
gotoxy(leftx,lefty);
}
void far setbkcolor(int color);
void far setcolor(int color);
#icnlude <stdio.h>
#include <graphics.h>
void main()
{
int gdriver,gmode,i;
gdriver=DETECT;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
setbkcolor(0);
cleardevice();
for(i=0;i<=15;i++)
{
setcolor(i);
circle(320,240,20+i*10);
delay(500);
}
for(i=0;i<=15;i++)
{
setbkcolor(i);
cleardevice();
circle(320,240,20+i*10);
delay(500);
}
closegraph();
}
#include <stdlib.h>
#include <graphics.h>
void main()
{
int gdriver,gmode,i;
int arw[16]={200,102,300,102,300,107,330,100,300,93,300,98,200,98,200,102};
gdriver=DETECT;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
setbkcolor(BLUE);
cleardevice();
setcolor(12);
drawpoly(8,arw);
getch();
closegraph();
}
structlinesettingstyle
{
int linestyle;
unsigned upattern;
int thickness;
};
struct linesettingstyle *info;
getlinesetings(info);
#include <stdlib.h>
#include <graphics.h>
void main()
{
int gdriver,gmode,i;
gdriver=DETECT;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
setbkcolor(BLUE);
cleardevice();
setcolor(RED);
circle(320,240,98);
setlinestyle(0,0,3);
setcolor(2);
rectangle(220,140,420,340);
setcolor(WHITE);
setlinestyle(4,0xaaaa,11);
line(220,240,420,240);
line(320,140,320,340);
getch();
closegraph();
}
#include <graphics.h>
void main(){
char str[8]={10,20,30,40,50,60,70,80};
int griver,gmode,i;
struct fillsettingstype save;
gdriver=DETECT;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
setbkcolor(BLUE);
cleardevice();
for(i=0;i<13;i++)
{
setcolor(i+3);
setfillstyle(i,2+i);
bar(100,150,200,50);
bar3d(300,100,500,200,70,1);
pieslice(200,300,90,180,90);
sector(500,300,180,270,200,100);
delay(1000);
}
cleardevice();
setcolor(14);
setfillpattern(str,RED);
bar(100,150,200,50);
bar3d(300,100,500,200,70,0);
pieslice(200,300,0,360,90);
sector(500,300,0,360,100,50);
getch();
getfillsettings(&save);
closegraph();
clrscr();
printf("The pattern is %d,The color of filling is %d",save.pattern,
save.color);
getch();
}
struct viewporttype{
int left,top,right,bottom;
int clipflag;
};
void far setactivepge(int pagenum);
void far setvisualpage(int pagenum);
void far outtext(char far *teststring);
void far outtextxy(int x,int y,char far *textsring);
int sprintf(char *string,char *format[argument..];
#include <graphics.h>
void main()
{
int i,graphdriver,graphmode;
char s[30];
graphdriver=DETECT;
initgraph(&graphdriver,&graphmode,"c:\\tc\\bgi");
cleardevice();
setbkcolor(BLUE);
setviewprot(40,40,600,440,1);
setfillstyle(1,2);
setcolor(YELLOW);
rectangle(0,0,560,400);
floodfill(50,50,14);
rectgangle(20,20,540,380);
setfillstyle(1,13);
floodfill(19,19,14);
setcolor(15);
settextstyle(1,0,6);
outtextxy(100,60,"Welcome Your");
setviewport(100,200,540,380,0);
setcolor(14);
setfillstyle(1,12);
rectagnle(20,20,420,120);
floodfill(21,100,14);
settextstyle(2,0,9);
i=620;
srpintf('s,"Your score is %d",i);
setcolor(YELLOW);
outtextxy(60,40,s);
setcolor(1);
settextstyle(3,0,0);
setusercharsize(4,1,1,1);
outtextxy(70,80,"Good");
getch();
closeraph(0;
}
#include <dos.h>
#include <conio.h>
#define Key_DOWN 0x5100
#define Key_UP 0x4900
#define Key_ESC 0x011b
#define Key_ALT_F 0x2100
#define Key_ALT_X 0x2d00
#define Key_ENTER 0x1c0d
main()
{
int i,key,x,y,l;
char *menu[]={"File","Edit","Run","Option","Help","Setup","Zoom","Menu"};
char *red[]={"F","E","R","O","H","S","Z","M"};
char *f[]={"Loadfile","Savefile","Print","Modify","QuitAlt_x"};
char buf[16*10*2],buf[16*2];
while(1)
{
textbackground(BLUE);
clrscr();
textmode(C80);
window(1,1,80,1);
textbackground(LIGHTGRAY);
textcolor(BLACK);
clrscr();
gotoxy(5,1);
for(i=0,l=0;i<8;i++)
{
x=wherex();
y=wherey();
cprintf("%s",menu[i]);
l=strlen(menu[i]);
gotoxy(x,y);
textcolor(RED);
cprintf("%s",red[i]);
x=x+1+5;
gotoxy(x,y);
textcolor(BLACK);
}
gotoxy(5,1);
key=bioskey(0);
switch(key){
case Key_ALT_X:
exit(0);
case Key_ALT_F:
{
textbackground(BLACK);
textcolor(WHITE);
gotoxy(5,1);
cprintf("%s",menu[0]);
gettext(5,2,20,12,buf);
window(5,2,20,9);
textbackground(LIGHTGRAY);
textcolor(BLACK);
clrscr();
for(i=2;i<7;i++)
{
gotoxy(2,i);
cprintf("%s",f[i-2]);
}
gettext(2,2,18,3,buf1);
textbackground(BLACK);
textcolor(WHITE);
gotoxy(2,2);
cprintf("%s",f[0]);
gotoxy(2,2);
y=2;
while((key=bioskey(0))!=KEY_ALT_X)
{
if((key==Key_UP)||(key==key_DOWN))
{
puttext(2,y,18,y+1,buf1);
if(key=key_UP)
y=(y==2?6:y-1);
else
y=(y==6?2:y+1);
gettext(2,y,18,y+1,buf1);
textbackground(BLACK);
textcolor(WHITE);
gotoxy(2,y);
cprintf("%s",f[y-2]);
gotoxy(2,y);
}
else
if(key==key_ENTER)
{
switch(y-1){
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
exit(0);
default:
break;
}
break;
}
else
if(key==key_ESC)
break;
}
if(key==KEY_ALT_X)
exit(0);
}
}
initm()
{
int L,T,R,i;
mWidth=550/MenuNum;
mHeight=20;
L=50;T=50;R=mWidth+L;
setfillstyle(SOLID_FILL,1);
bar(50,50,600,70);
setcolor(RED);
settextstyle(1,HORIZ_DIR,1);
outtextxy(L+12,T,MainMenu[0].MenuName);
L=R;R=mWidth+L;
setfillstyle(SOLID_FILL,7);
bar(50,50,600,70);
setcolor(RED);
settexxy(L+12,T,MainMenu[0].MenuName);
L=R;R=mWidth+L;
for(i=1;i<MenuNum;i++)
{
setcolor(BALCK);
settextstyle(1,HORIZ_DIR,
花儿迎风笑
- 粉丝: 114
- 资源: 82
最新资源
- (源码)基于C语言的系统服务框架.zip
- (源码)基于Spring MVC和MyBatis的选课管理系统.zip
- (源码)基于ArcEngine的GIS数据处理系统.zip
- (源码)基于JavaFX和MySQL的医院挂号管理系统.zip
- (源码)基于IdentityServer4和Finbuckle.MultiTenant的多租户身份认证系统.zip
- (源码)基于Spring Boot和Vue3+ElementPlus的后台管理系统.zip
- (源码)基于C++和Qt框架的dearoot配置管理系统.zip
- (源码)基于 .NET 和 EasyHook 的虚拟文件系统.zip
- (源码)基于Python的金融文档智能分析系统.zip
- (源码)基于Java的医药管理系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈