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

📄 tu2.c

📁 在以前公司DOS环境下
💻 C
字号:
#include "svgacc.h"
#include <dos.h>
#include <bios.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <io.h>
#include <time.h>
#include <string.h>

#define enter 13
#define esc 27
#define ESC 27
#define BACKSPACE 8
#define ENTER 13
#define kbF1 187
#define kbF2 188
#define kbF3 189
#define kbF4 190
#define kbF5 191
#define kbF6 192
#define kbF7 193

#define kbUp 200
#define kbDn 208
#define kbCtrlE 5
#define kbCtrlZ 26

#define BLACK 0
#define lBLUE 1
#define lGREEN 2
#define lCYAN 3
#define lRED 4
#define lPINK 5
#define lYELLOW 6
#define lWHITE 7
#define GRAY 8
#define BLUE 9
#define GREEN 10
#define CYAN 11
#define RED 12
#define PINK 13
#define YELLOW 14
#define WHITE 15

static char ASCbuf[4096];
static char buf11[80];
static char buf12[80];
FILE *fpHZ;

void drwhz24str(char *s,int x,int y,int m,int n,int col,int mode);
void  drwhzstr(char *s,int x,int y,int m,int n,unsigned char col,PixelMode mode);
void drwstr(char *s,int x,int y,int m,int n,unsigned char col,PixelMode mode);
void drwbutton(char *phstr,char *str,int x,int y,PixelMode i,int col11);

int getkey(void);
void main(void)
{ 
 int ok;
 int j;
 char fname[8];
 char bufg[8];
 FILE *fp;

 if ((fpHZ=fopen("hzk16","rb"))==NULL)
   { printf("open hzk16 error\n");
    exit(0);
    }
 if ((fp=fopen("asc16","rb"))==NULL)
    { printf("open file error");
    exit(1);
    }
 if (fgets(ASCbuf,4096,fp)==NULL)
    {
      printf("error");
      exit(1);
    }
 whichvga();
 res800();
 ok=0;
/* windows(0,0,800,600); */
/* 图头 */
   
   drwbox(SET,lPINK,0,0,800,600);
   drwbox(SET,lPINK,1,1,799,599);
   drwbox(SET,lPINK,2,2,798,598);
   drwfillbox(SET,GRAY,3,3,797,597);
  
   drwline(SET,lPINK,2,22,799,22);
   drwline(SET,lPINK,2,22,799,22);
   drwfillbox(SET,WHITE,3,3,798,21);
   strcpy(buf11,"瓦楞纸板生产线换单系统:横切机控制");
   drwhzstr(buf11,4,5,1,1,lBLUE,SET);
   drwbox(SET,lYELLOW,5,25,795,80);
   drwbox(SET,lYELLOW,6,26,794,79);
   drwfillbox(SET,WHITE,7,27,793,78);

   strcpy(buf11,"湖北京山轻工机械股份有限公司");
   drwhzstr(buf11,132,36,1,2,lPINK,SET);
   strcpy(buf11,"地址:湖北省京山县新市镇轻机大道");
   drwhzstr(buf11,210,62,1,1,lPINK,SET);

 strcpy(buf11,"78"); 
 drwstring(SET,lPINK,15,buf11,466,64);
 strcpy(buf11,"号");
 drwhzstr(buf11,482,62,1,1,lPINK,SET);
   
 
   strcpy(buf11,"博成电脑");
   drwhz24str(buf11,600,36,1,1,lPINK,SET);
   drwhz24str(buf11,601,37,1,1,lPINK,SET);
   drwhz24str(buf11,602,38,1,1,lPINK,SET);

   drwbox(SET,lYELLOW,5,86,795,222);
   drwbox(SET,lYELLOW,6,87,794,221);
   drwfillbox(SET,lCYAN,7,88,793,220);
 
 
   drwbox(SET,GREEN,9,90,116,148);
   drwbox(SET,GREEN,10,91,115,147);
   drwfillbox(SET,lBLUE,11,92,114,146);
 
   strcpy(buf11,"速");
 
   drwhzstr(buf11,16,103,2,3,WHITE,SET);
   drwhzstr(buf11,15,103,2,3,WHITE,SET);
   strcpy(buf11,"度");
   drwhzstr(buf11,66,103,2,3,WHITE,SET);
   drwhzstr(buf11,65,103,2,3,WHITE,SET);

  /*生产数量*/
   drwbox(SET,GREEN,119,90,389,148);
   drwbox(SET,GREEN,120,91,388,147);
   drwfillbox(SET,lBLUE,121,92,387,146);
   strcpy(buf11,"生产数量");
   drwhzstr(buf11,169,103,2,3,WHITE,SET);
   drwhzstr(buf11,168,103,2,3,WHITE,SET);

  /*剩余数量*/
   drwbox(SET,GREEN,392,90,650,148);
   drwbox(SET,GREEN,393,91,649,147);
   drwfillbox(SET,lBLUE,394,92,648,146);
   strcpy(buf11,"剩余数量");
   drwhzstr(buf11,428,103,2,3,WHITE,SET);
   drwhzstr(buf11,427,103,2,3,WHITE,SET);

  /*废品*/
   drwbox(SET,GREEN,653,90,793,148);
   drwbox(SET,GREEN,654,91,792,147);
   drwfillbox(SET,RED,655,92,791,146);
   strcpy (buf11,"废");

   drwhzstr(buf11,667,104,2,3,WHITE,SET);
   drwhzstr(buf11,666,103,2,3,WHITE,SET);
   strcpy(buf11,"品"); 
   drwhzstr(buf11,732,104,2,3,WHITE,SET);
   drwhzstr(buf11,731,103,2,3,WHITE,SET);

  /************************************/
   drwbox(SET,GREEN,9,152,116,215);  
   drwbox(SET,GREEN,10,153,115,214);
   drwfillbox(SET,lBLUE,11,154,114,213);
 
   drwbox(SET,GREEN,119,152,389,215);
   drwbox(SET,GREEN,120,153,388,214);
   drwfillbox(SET,lBLUE,121,154,387,213);   

   drwbox(SET,GREEN,392,152,650,215);
   drwbox(SET,GREEN,393,153,649,214);
   drwfillbox(SET,lBLUE,394,154,648,213);

   drwbox(SET,GREEN,653,152,793,215);
   drwbox(SET,GREEN,654,153,792,214);
   drwfillbox(SET,RED,655,154,791,213);



   drwbox(SET,RED,5,226,795,540);
   drwbox(SET,RED,6,227,794,539);
   drwfillbox(SET,BLACK,7,228,793,538); 

   drwfillbox(SET,CYAN,9,230,72,250);
   strcpy(buf11,"工号");
   drwfillbox(SET,CYAN,74,230,115,250);
   drwhzstr(buf11,76,232,1,1,lPINK,SET);
   strcpy(buf11,"定单号");
   drwfillbox(SET,CYAN,117,230,169,250);
   drwhzstr(buf11,119,232,1,1,lPINK,SET);
 
 
   drwfillbox(SET,GREEN,9,260,72,282);
   strcpy(buf11,"已生产");
   drwhzstr(buf11,20,262,1,1,BLACK,SET);
   drwfillbox(SET,RED,9,288,72,310);
   strcpy(buf11,"生产中");
   drwhzstr(buf11,20,290,1,1,lPINK,SET);
   drwfillbox(SET,BLUE,9,316,72,338);
   strcpy(buf11,"待生产");
   drwhzstr(buf11,20,320,1,1,RED,SET);
 
   strcpy(buf11,"纸质");
   drwfillbox(SET,CYAN,171,230,550,250);
   drwhzstr(buf11,353,232,1,1,lPINK,SET);

   strcpy(buf11,"纸宽");
   drwfillbox(SET,CYAN,552,230,593,250);
   drwhzstr(buf11,555,232,1,1,lPINK,SET);

   strcpy(buf11,"剖数");
   drwfillbox(SET,CYAN,595,230,636,250);
   drwhzstr(buf11,600,232,1,1,lPINK,SET);

   strcpy(buf11,"长度");
   drwfillbox(SET,CYAN,638,230,679,250);
   drwhzstr(buf11,642,232,1,1,lPINK,SET);
   
   strcpy(buf11,"数量");
   drwfillbox(SET,CYAN,681,230,748,250);
   drwhzstr(buf11,699,232,1,1,lPINK,SET);

   strcpy(buf11,"限速");
   drwfillbox(SET,CYAN,750,230,791,250);
   drwhzstr(buf11,757,232,1,1,lPINK,SET);


   strcpy(buf12,"F1");
   strcpy(buf11,"定单输入");
   drwbutton(buf12,buf11,8,545,SET,44);
   strcpy(buf12,"F2");
   strcpy(buf11,"强制换单");
   drwbutton(buf12,buf11,88,545,SET,44);
   strcpy(buf12,"F3");
   strcpy(buf11,"定单保存");
   drwbutton(buf12,buf11,167,545,SET,44);
   strcpy(buf12,"F4");
   strcpy(buf11,"定单浏览");
   drwbutton(buf12,buf11,247,545,SET,44);
   strcpy(buf12,"F5");
   strcpy(buf11,"定单上载");

   drwbutton(buf12,buf11,326,545,SET,44);
   strcpy(buf12,"F6");
   strcpy(buf11,"生产定单");

   drwbutton(buf12,buf11,406,545,SET,44);
   strcpy(buf12,"F7");
   strcpy(buf11,"自动换单");

   drwbutton(buf12,buf11,485,545,SET,44);
   strcpy(buf12,"F8");
   strcpy(buf11,"取消换单");

   drwbutton(buf12,buf11,565,545,SET,44);
   strcpy(buf12,"+/-");
   strcpy(buf11,"废品计数");

   drwbutton(buf12,buf11,644,545,SET,44);
   strcpy(buf12,"ESC");
   
   strcpy(buf11,"退出系统");

   drwbutton(buf12,buf11,725,545,SET,44);
    
    strcpy(buf11,"开机时间");

    drwfillbox(SET,PINK,9,516,87,536);
    drwhzstr(buf11,11,518,1,1,WHITE,SET);
    drwfillbox(SET,CYAN,89,516,170,536);  

    strcpy(buf11,"平均车速");
    drwfillbox(SET,PINK,172,516,250,536);
    drwhzstr(buf11,174,518,1,1,WHITE,SET);
    drwfillbox(SET,CYAN,252,516,293,536);
 
    strcpy(buf11,"停车次数");
    drwfillbox(SET,PINK,295,516,374,536);
    drwhzstr(buf11,297,518,1,1,WHITE,SET);
    drwfillbox(SET,CYAN,376,516,418,536);


    strcpy(buf11,"停车时间");
    drwfillbox(SET,PINK,420,516,498,536);
    drwhzstr(buf11,422,518,1,1,WHITE,SET);
    drwfillbox(SET,CYAN,500,516,580,536);

    strcpy(buf11,"生产总长");
    drwfillbox(SET,PINK,582,516,660,536);
    drwhzstr(buf11,584,518,1,1,WHITE,SET);
    drwfillbox(SET,CYAN,662,516,792,536);




    strcpy(fname,"cutoff1.pcx");
    pcxmake(0,0,799,599,fname);

 while(!ok)
  {  
  while (kbhit())
     {j=getkey();
      switch (j)
       {case esc:
             {ok=1;
              break;
             }
        case enter:
            ok=0;     
       }
     }
     sdelay(60);  
     _strtime(bufg);
   } 
  
  fclose(fpHZ);
 
  restext();
  }
void drwhzstr(char *s,int x,int y,int m,int n,
             unsigned char col,PixelMode mode)
 { unsigned char dot[16][2],qm,wm;
   long offset1;
   register i,j,k,mm,nn,mask;
    while(*s)
     { qm=s[0]-0xa1;
       s+=1;
       wm=s[0]-0xa1;

       offset1=((long)qm*94+(long)wm)*32;
       s+=1;
       fseek(fpHZ,offset1,SEEK_SET);
       for(i=0;i<=15;i++)
        {for(j=0;j<2;j++)
         { dot[i][j]=fgetc(fpHZ);
           mask=0x80;
           for(k=0;k<=7;k++)
             {if (dot[i][j]&mask)
               {for(nn=0;nn<n;nn++)
                 {for(mm=0;mm<m;mm++)
                 drwpoint(mode,col,x+(j*8+k)*n+nn,y+i*m+mm);

                 }
               }
               mask=mask>>1;
              }
         }
        }
       x+=15*n;
     }

 }
int getkey(void)
{ union REGS in,out;
  in.h.ah=0x8;
  int86(0x21,&in,&out);
  if(out.h.al==0)
   return getkey()+128;
  else
   return out.h.al;
}
void drwstr(char *s,int x,int y,int m,int n,
          unsigned char col,PixelMode mode)
 { unsigned char dot[16][2];
   long offset1;
   register i,j,k,mm,nn,mask;

    while(*s)
     { offset1=(long)(*s)*16;
       s+=1;
       j=0;
       for(i=0;i<=15;i++)
         { dot[i][j]=ASCbuf[offset1+i];
           mask=0x80;
           for(k=0;k<=7;k++)
             {if (dot[i][j]&mask)
               {for(nn=0;nn<n;nn++)
                 {for(mm=0;mm<m;mm++)
                  drwpoint(mode,col,x+(j*8+k)*n+nn,y+i*m+mm);
                 }
               }
               mask=mask>>1;
              }
         }
       x+=8*n;
     }
}


void drwbutton(char *phstr,char *str,int x,int y,PixelMode i,int col11)
{
  int k,j;
  int xn,yn;
  k=strlen(phstr);
  j=strlen(str);
  xn=x+j*8;
  yn=y+2+16+14+16+2;
  
drwline(i,7,x,y,xn,y);
drwline(i,7,x,y-1,xn+1,y-1);
drwline(i,7,x,y-2,xn+2,y-2);
drwline(i,7,x,y-2,x,yn);
drwline(i,7,x-1,y-2,x-1,yn+1);
drwline(i,7,x-2,y-2,x-2,yn+2);
drwline(i,0,xn+2,y-1,xn+2,yn+2);
drwline(i,0,xn+1,y,xn+1,yn+2);
drwline(i,0,xn,y+1,xn,yn+2);
drwline(i,0,x-1,yn+2,xn+2,yn+2);
drwline(i,0,x,yn+1,xn+2,yn+1);
drwline(i,0,x+1,yn,xn+2,yn);
drwfillbox(i,col11,x+1,y+1,xn-1,yn-1);
drwstr(phstr,x+(xn-x)/2-k*16/2,y+4,1,2,BLACK,i);                 /*x+(j*16)/2-(8*k)/2,y+2,1,1,0,i);*/
/*drwstring(i,5,8,text7,732,554); */
drwhzstr(str,x+2,y+2+16+14,1,1,RED,i);
}
void drwhz24str(char *s,int x,int y,int m,int n,
             int col,int mode)
 { unsigned char dot[24][3],qm,wm;
   long offset1;
   register i,j,k,mm,nn,mask;
   FILE *fpHZ;

   if((fpHZ=fopen("hzk24k","rb"))==0)
     {printf("Error: HZK24K can't open.\n");
      exit(0);
     }
   while(*s)
     { qm=(unsigned char)(s[0]-0xa0);
       s+=1;
       wm=(unsigned char)(s[0]-0xa0);

       offset1=((long)(qm-16)*94+(long)(wm-1))*72L;
       s+=1;
       fseek(fpHZ,offset1,SEEK_SET);
       for(i=0;i<24;i++)
        {for(j=0;j<3;j++)
         { dot[i][j]=fgetc(fpHZ);
           mask=0x80;
           for(k=0;k<=7;k++)
             {if (dot[i][j]&mask)
               {for(nn=0;nn<n;nn++)
                 {for(mm=0;mm<m;mm++)   
                 drwpoint(mode,col,x+i*2,y+(j*8+k));

                 }    
               }  
               mask=mask>>1;
              }
         }
        }
       x+=48;
     }
 fclose(fpHZ);
}           

⌨️ 快捷键说明

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