⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 header.h

📁 这是一个人力资源管理软件。运行MAIN.CPP 进入“登陆信息”。 要进入员工管理页面请如下输入 empid - JOEL ,password - JOEL 进入管理人员界面: empid - ADM
💻 H
字号:
#define TRUE 1      //TRUE
#define FALSE 0     //FALSE


int textboxjump=10;
int globalbut=0;
int globalx=0;
int globaly=0;
union REGS i,oo;
//CLASS MOUSE

void graph();  //initialize the graphics

class mousee    //This is all simple mouse coding
{ public:
int initmouse();
void hidemouseptr();
void showmouseptr();
void getmousepos();

}mouse;       //mouse over here is the global object
//END

//CLASS BUTTON
class button
{
int l;
int t;
int r;
int b;
int z;
int type;
public:
button()	{l=0;t=0;r=0;b=0;z=0;type=0;}
button(int e,int f,int g=0,int h=0)
{l=e;
 t=f;
  if((g==0)&&(h==0))     //This is where I'am using the default
	 { r=e+69; b=f+22;}     //value for button
   else
	 { r=g; b=h;}
	 z=0;
	 type=0;
  }

void show(int);
void push();
int check();
void tbutton(int);
};
//END

//CLASS LOGO

//MOUSE FUNCTIONS

 int mousee::initmouse( )
	{
	i.x.ax = 0 ;
	int86 ( 0x33, &i, &oo ) ;
	return ( oo.x.ax ) ;
	}

	void mousee::hidemouseptr()
	  {
	  i.x.ax=2;
	  int86(0x33,&i,&oo);
	  }

	void mousee::showmouseptr( )
	{
	i.x.ax = 1 ;
	int86 ( 0x33, &i, &oo ) ;
	}


	void mousee::getmousepos ()
	{
	i.x.ax = 3 ;
	int86 ( 0x33, &i, &oo ) ;
	globalbut =oo.x.bx ;
	globalx = oo.x.cx ;
	  globaly = oo.x.dx ;
}
//END


//BUTTON FUNCTIONS

void button::tbutton(int k=0)
	{
	type=k;
	}

void button::show(int k=7)
{
 if(type==0)
 {
 if(z==0)
	{
	setfillstyle(SOLID_FILL,k);
	bar(l,t,r,b);
	z++;  }
// setlinestyle(0,0,1);
 setcolor(7);
 line(l,t,r,t);
 line(l,t,l,b);
 setcolor(DARKGRAY);
 line(r-1,t+1,r-1,b-1);
 line(l+1,b-1,r-1,b-1);
 setcolor(DARKGRAY);
 line(r,t,r,b);
 line(l,b,r,b);
 //setlinestyle(0,0,0);
}
if(type==1)
{
if(z==0)
	{
	setfillstyle(SOLID_FILL,k);
	//setfillstyle(1,7);
	fillellipse(l,((t+b)/2),((b-t)/2)-1,((b-t)/2)-1);
	fillellipse(r,((t+b)/2),((b-t)/2)-1,((b-t)/2)-1);
	bar(l,t,r,b);
	z++;
	}
 setcolor(15);
 line(l,t,r,t);
 ellipse(l,(t+b)/2,90,180,((b-t)/2)-1,((b-t)/2)-1);
 ellipse(r,(t+b)/2,0,90,((b-t)/2)-1,((b-t)/2)-1);
 setcolor(DARKGRAY);
 line(l+1,b-1,r-1,b-1);
 ellipse(r,(t+b)/2,270,0,((b-t)/2)-float(1.5),((b-t)/2)-2);
 ellipse(l,(t+b)/2,180,270,((b-t)/2)-float(1.5),((b-t)/2)-2);
 setcolor(0);
 line(l,b,r,b);
 ellipse(r,(t+b)/2,270,0,((b-t)/2)-1,((b-t)/2)-1);
 ellipse(l,(t+b)/2,180,270,((b-t)/2)-1,((b-t)/2)-1);
}
if(type==2)
{
  if(z==0)
	{
	setfillstyle(SOLID_FILL,k);
	//setfillstyle(1,7);
	fillellipse(l,t,r,b);
	z++;
	}
 setcolor(15);
 ellipse(l,t,0,180,r,b);
 setcolor(DARKGRAY);
 ellipse(l,t,180,0,r-1,b-1);
 setcolor(0);
 ellipse(l,t,180,0,r,b);
}
}
void button::push()
{
if(type==0)
{
 setcolor(0);
 line(l,t,r,t);
 line(l,t,l,b);
 setcolor(7);
 line(r,t,r,b);
 line(l,b,r,b);
 //setlinestyle(0,0,0);
}
if(type==1)
{
 setcolor(0);
 line(l,t,r,t);
 ellipse(l,(t+b)/2,90,180,((b-t)/2)-1,((b-t)/2)-1);
 ellipse(r,(t+b)/2,0,90,((b-t)/2)-1,((b-t)/2)-1);
 setcolor(15);
 line(l,b,r,b);
 ellipse(r,(t+b)/2,270,0,((b-t)/2)-1,((b-t)/2)-1);
 ellipse(l,(t+b)/2,180,270,((b-t)/2)-1,((b-t)/2)-1);
}
if(type==2)
{
 setcolor(0);
 ellipse(l,t,0,180,r,b);
 setcolor(15);
 ellipse(l,t,180,0,r,b);
}
}

int button::check()
{
mouse.getmousepos();
if(type==0)
{
if((globalx>l)&&(globalx<r)&&(globaly>t)&&(globaly<b) || textboxjump==10)
{
       push();
       mouse.getmousepos();
	for(int i=25;i<28;i++)
	{
	sound(i*100);
	delay(20);
	nosound();
	}

		while((globalx>l)&&(globalx<r)&&(globaly>t)&&(globaly<b) || textboxjump==10 )
		{
		if((globalbut&1)==1  || textboxjump==10)
		{
		 textboxjump=0;
		 return(1);
		}
		mouse.getmousepos();
		push();
		}
}
show();
return(0);
}
if(type==1)
{
if((globalx>(l-(b/2-t/2)))&&(globalx<(r+(b/2-t/2)))&&(globaly>t)&&(globaly<b)  || textboxjump==10)
{
       push();
	  mouse.getmousepos();
	for(int i=25;i<28;i++)
	{
	sound(i*100);
	delay(20);
	nosound();
	}

		while((globalx>(l-(b/2-t/2)))&&(globalx<(r+(b/2-t/2)))&&(globaly>t)&&(globaly<b) || textboxjump==10)
		{
		if((globalbut&1)==1  || textboxjump==10)
		{
		 textboxjump=0;
		 return(1);
		}
		mouse.getmousepos();
		push();
		}
}
show();
return(0);
}
if(type==2)
{
if((globalx>l-r)&&(globalx<l+r)&&(globaly>t-b)&&(globaly<t+b)  || textboxjump==10)
{
	  push();
	  mouse.getmousepos();
	for(int i=25;i<28;i++)
	{
	sound(i*100);
	delay(20);
	nosound();
	}

		while((globalx>l-r)&&(globalx<l+r)&&(globaly>t-b)&&(globaly<t+b)  || textboxjump==10)
		{
		if((globalbut&1)==1  || textboxjump==10)
		{
		 textboxjump=0;
		 return(1);
		}
		mouse.getmousepos();
		push();
		}
}
show();
return(0);

}

return(0);
}
//END

//LOGO FUNCTIONS



void graph()
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;

/* initialize graphics mode */
initgraph(&gdriver, &gmode, "");

/* read result of initialization */
errorcode = graphresult();

if (errorcode != grOk)  /* an error occurred */
{
   printf("Graphics error: %s\n", grapherrormsg(errorcode));
   printf("Press any key to halt:");
   getch();
   exit(1);             /* return with error code */
}

}


//BITMAP FUNCTIONS

ifstream fp;
void loadbmp(char *name,int offset, int w, int h);
void readdata(char *name)
{
	cleardevice();
	fp.open(name);
	if (!fp) {
		fp.close();
		setcolor(RED);
		cout<<"Error Opening file "<<name<<"\nMake sure all the required Files are in the same directory and they are not in use.\t";cout<<"\n\t\tPress enter to exit.";
		getche();
		exit(1);
		}
	int data1;
	long data2;
	int type;
	fp.read((char*)&type,sizeof(type));
	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));
	int offset=data2;
	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));
	int w=data2;
	fp.read((char*)&data2,sizeof(data2));
	int h=data2;
	fp.read((char*)&data1,sizeof(data1));
	fp.read((char*)&data1,sizeof(data1));

	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));
	fp.read((char*)&data2,sizeof(data2));

	loadbmp(name,offset,w,h);

	fp.close();
}
//~loadbmp(){};
//};

void loadbmp(char *name,int offset, int w, int h) {
	char data3;
	fp.seekg(offset);
	int a=w;
	if(w%8!=0)
	a=(w+8)-(w%8);
	int count=0,row=h;
	long pos;
	while(row>0 && count<a)
	{
		while(!fp.eof())
		{
			fp.read(&data3 , sizeof(data3));
			gotoxy(150,120);
			putpixel(count , row , ((data3 & 0xf0)>>4));
			count++;
			gotoxy(150,120);
			putpixel(count , row , data3 & 0x0f);
			count++;
			if(count>=a)
			{
				count=0;
				row-=1;
			}
		}
		pos=fp.tellg();
		fp.close();
		fp.open(name);
		count++;
		if(count==a)
			count=0;
		count++;
		if(count==a)
			count=0;

		fp.seekg(pos+2);
	}
// return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -