📄 status.cpp
字号:
#if !defined( __DOS_H )
#include <Dos.h>
#endif // __DOS_H
#if !defined( __STDIO_H )
#include <StdIO.h>
#endif // __STDIO_H
#define Uses_Graph
#define Uses_Mouse
#include <ly.h>
const
statusTop = 455,
statusHeight = 18,
statusSpace = 24;
const
dtWidth = 8 * 8,
timeLeft = 640 - statusSpace - dtWidth,
dateLeft = timeLeft - statusSpace - dtWidth,
dutyWidth = 11 * 8,
dutyLeft = dateLeft - statusSpace - dutyWidth,
statusLeft = statusSpace,
statusWidth = dutyLeft - statusSpace - statusLeft;
void ClearStatus()
{
HideCursor();
const left = 4,
top = statusTop - 5,
right = 636,
bottom = 475;
Graph::bar( left, top, right, bottom, 7 );
Graph::line( left, top, right, top, 0 );
HallowBoard( statusLeft - 1, statusTop - 1, statusWidth + 2, statusHeight );
HallowBoard( dutyLeft - 1, statusTop - 1, dutyWidth + 2, statusHeight );
HallowBoard( dateLeft - 1, statusTop - 1, dtWidth + 2, statusHeight );
HallowBoard( timeLeft - 1, statusTop - 1, dtWidth + 2, statusHeight );
struct date d;
getdate( &d );
char str[ 9 ];
sprintf( str, "%2u月%2u日", d.da_mon, d.da_day );
Graph::setcolor( 10, 7 );
Graph::showhz( dateLeft, statusTop, str );
ShowCursor();
}
void ShowStatus( char *szStatus )
{
HideCursor();
Graph::bar( statusLeft, statusTop,
statusLeft + statusWidth, statusTop + 15, 7 );
Graph::outtextxy( statusLeft, statusTop, szStatus );
ShowCursor();
}
void ShowDutyNum( char *szDutyNum )
{
HideCursor();
Graph::setcolor( 11, 7 );
char str[ 20 ];
sprintf( str, "收款员:%s", szDutyNum );
str[ 11 ] = 0;
Graph::showhz( dutyLeft, statusTop, str );
ShowCursor();
}
void ClearDutyNum()
{
HideCursor();
Graph::bar( dutyLeft, statusTop, dutyLeft + dutyWidth, statusTop + 15, 7 );
ShowCursor();
}
void ShowClock()
{
static char lastSecond=0;
struct time curTime;
gettime(&curTime);
char str[9];
if(curTime.ti_sec!=lastSecond)
{
HideCursor();
sprintf(str,"%2u:%02u:%02u",curTime.ti_hour,curTime.ti_min,
curTime.ti_sec);
Graph::setcolor(9,7);
Graph::showhz(timeLeft,statusTop,str);
lastSecond=curTime.ti_sec;
ShowCursor();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -