📄 myico.h
字号:
/* ==================================================== */
/* */
/* 学生宿舍管理系统Ver 1.00.1 源代码 */
/* 文件名: MyIco.h */
/* 作用: 主要负责将一个图标(Ico)文件画在屏幕上 */
/* 这里偷了点懒,程序默认图标是16*16的16色图标 */
/* 版权所有 (c) 2007 张元龙 保留所有权利 */
/* */
/* ==================================================== */
#include <stdio.h>
#include <string.h>
#ifndef IcoDefined
#define IcoDefined
#define bool char
#define true 1
#define false 0
typedef unsigned short word,Word,WORD;
typedef unsigned long DWord,dword,Dword,DWORD;
typedef unsigned char byte,Byte,BYTE;
typedef long LONG;
const byte convert[16]={0,4,2,6,1,5,3,7,8,12,10,14,9,13,11,15};
typedef byte TIcoBuf[0x80];
void DrawIco(TIcoBuf IcoBuf,int x,int y){
int i,j;
byte hb,lb;
for (i=0;i<16;i++)
for (j=0;j<8;j++){
lb=IcoBuf[i*8+j] & 0xF;
hb=IcoBuf[i*8+j] >>4;
if (hb!=0) putpixel(x+j*2,y+15-i,hb);
if (lb!=0) putpixel(x+j*2+1,y+15-i,lb);
}
}
void LoadIcoFile(char *filename,TIcoBuf IcoBuf){
FILE *FP;
int i;
byte hb,lb;
if ((FP=fopen(filename,"r"))==NULL) {
printf("Cannot open the icon files!\n");
getch();
exit(0);
}
fseek(FP,0x7E,SEEK_SET);
fread(IcoBuf,0x80,1,FP);
fclose(FP);
for (i=0;i<0x80;i++){
lb=convert[IcoBuf[i] & 0xF];
hb=convert[IcoBuf[i] >> 4];
IcoBuf[i]=lb | (hb <<4);
}
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -