热门关键词: 无法停止通用设备 青州灌装设备 肉类加工设备 饮料生产成套设备 中国特种设备 电线电缆设备 深圳二手干洗设备
  IC库存(8958万) PDF资料(329万) IC价格 IC求购 资讯 技术资料
电子元器件搜索:
维库电子市场网是知名的电子元器件交易网站,为电子生产企业提供IC库存和技术资料查询服务。
相关专题
响应古版号召,贴上一段菜单与界面的程序~~~(再添几个工具)
新闻出处:21ic 发布时间:2007-09-14
原野之狼 发布于 2007-9-13 18:15:00
昨儿个为了练习一下贴图,在此版发了一个俺做得产品的界面图。
承蒙古版厚爱,现贴上菜单与界面部分的源码。
小狼俺去年才毕业,造诣尚浅,混迹与21IC BBS一年有余,受到许多朋友支持与帮助,受益匪浅,感激不尽!
现贴此拙作,希望对于新手有所帮助。
小狼俺乐于与众网友分享一些快乐与痛苦。

源码下载:
http://bbs.21ic.com/upfiles/img/20079/2007914144218555.rar

为了方便阅读,我做了一个SOURCE INSIGHT排版后的PDF版本,可惜太大传不上来,有需要的朋友可以EMAIL给我。
声明:代码质量不高,仅供学习之用!

效果图片如下:

启动界面


主界面


工作时界面


菜单


设置界面


在规划界面时很实用很简单的工具




在编辑源码时很棒的工具


画框图和流程图时很不错的工具


* - 本贴最后修改时间:2007-9-14 14:44:21 修改者:原野之狼


原野之狼 发布于 2007-9-13 18:16:00
/************************************************************
    FileName: Gui.h

    Author:胡贵    

    Version :V1.0      

    Date: 2007.9.13

    Description:
        用于GUI的一些底层代码,只是部分功能,
        还需要完善

    History:

      <author>      <time>      <version >      <desc>


************************************************************/

#ifndef _GUI_H_
#define _GUI_H_

#include "comm.h"
#include "ds1302.h"

#define X_PIXEL 128
#define Y_PIXEL 64


#define X_PIXEL_NUMBER 3
#define Y_PIXEL_NUMBER 5

struct GUI_RECT
{
    UINT8 x0;
    UINT8 x1;
    UINT8 y0;
    UINT8 y1;
};

struct Text
{
    UINT8 code* *p_Content;
/*#if TextProperty
    UINT8 X_Distance;
    UINT8 L_Margin;
    UINT8 R_Margin;
    UINT8 zimu_X_X;
#endif*/
};


struct GUI_BUTTON
{
    UINT8 *p_HZ_STR;
    UINT8 x;
    UINT8 y;
    UINT8 dx;
    UINT8 dy;
};


struct StpLabelBlk_YMD
{
    struct Time *p_Time;
    struct Time Time_Temp;
    UINT8 Location_Cur_Crt;
    UINT8 x;
    UINT8 y;
};

struct StpLabelBlk_Int
{
    UINT16 *p_Dat;
    UINT8 Location_Cur_Crt;
    UINT8 n_Bit;
    UINT16 Dat_Temp;
    UINT8 x;
    UINT8 y;
};

//逻辑开关量设置页数据结构
struct StpLabelBlk_Logic
{
    UINT8 *p_Dat;
    UINT8 Dat_Temp;
    UINT8 x;
    UINT8 y;
    UINT8 Location_Cur_Crt;
};


/*The base GUI function declaration*/
void GUI_DrawPixel(UINT8 x,UINT8 y);
void GUI_DrawHLine(UINT8 x0,UINT8 x1,UINT8 y);
void GUI_DrawHLine_(UINT8 x0,UINT8 x1,UINT8 y);
void GUI_DrawVLine(UINT8 y0,UINT8 y1,UINT8 x);
void GUI_DrawRect(UINT8 x0,UINT8 x1,UINT8 y0,UINT8 y1);
UINT8 code* GetCharPointer(UINT8 character);
void GUI_DispChars(UINT8 *p_Char,UINT8 x,UINT8 y);
void GUI_DispLine(struct Text *p_Text,UINT8 n_Disp,struct GUI_RECT *p_Rect);
void GUI_DisIntData(INT16 dat,UINT8 x,UINT8 y,UINT8 *formate);
void GUI_DisFloatData(FLP32 dat,UINT8 x,UINT8 y,UINT8 *formate);

void GUI_InvertRect(UINT8 x0,UINT8 x1,UINT8 y0,UINT8 y1);
void GUI_ClearRect(UINT8 x0,UINT8 x1,UINT8 y0,UINT8 y1);


void ZK_To_Bitmap(UINT8 code* zk,UINT8 row,UINT8 col,UINT8* p_Bitmap);
void RegionInsertInDisBuffer(struct GUI_RECT* rect,UINT8* p_Content);
//UINT8 code* GetCharPointer(UINT8 character);


UINT16 get_hz_const(UINT8 *p);
UINT8 Generate_HZ_Group(UINT8 *p,UINT8 code **HZ_Group);
UINT8  GUI_DispLine_(UINT8 *p_HZ_Str,UINT8 x,UINT8 y);
void GUI_DrawArrow(UINT8 up_down);
void GUI_ClearAll(void);



void Gui_CharacterStyle_Set7_4(void);
void Gui_CharacterStyle_Set12_6(void);



void GUI_DrawButton(struct GUI_BUTTON *p_btn, UINT8 *p_HZ_Str,UINT8 x,UINT8 y,UINT8 dx,UINT8 dy);
void GUI_ButtonClick(struct GUI_BUTTON *p_btn);
void GUI_ButtonRelease(struct GUI_BUTTON *p_btn);
void GUI_ClearPixel(UINT8 x,UINT8 y);


void CreateStpLabel_YMD(UINT8 *p_HZ_Str,UINT8 x_HZ,UINT8 y_HZ,struct Time *p_T, UINT8 x_T,UINT8 y_T,UINT8 flag);
void OnOK_YMD(UINT8 flag);
void OnPre_YMD(UINT8 flag);
void OnNxt_YMD(UINT8 flag);

void CreateStpLable_Logic(UINT8 *p_HZ_Str,UINT8 *p_Logic,UINT8 x_HZ,UINT8 y_HZ,UINT8 x_dat,UINT8 y_Dat);
void OnOK_Logic(void);
void OnPre_Logic(void);
void OnNxt_Logic(void);
void OnCancle_Logic(void);

void CreateStpLabel_Int(UINT8 *p_HZ_Str,UINT8 x_HZ,UINT8 y_HZ,UINT16 *p_Int, UINT8 x_Dat,UINT8 y_Dat,UINT8 n_Int);
//UINT8 GetBCD_At(UINT16 dat,UINT8 n_Bit,UINT8 Location_Bit);
signed char GetBCD_At(UINT16 dat,UINT8 n_Bit,UINT8 Location_Bit);
void OnOk_Int(void);
void OnPre_Int(void);
void OnNxt_Int(void);
void OnCancle_Int(void);

#endif


* - 本贴最后修改时间:2007-9-13 18:20:34 修改者:原野之狼


原野之狼 发布于 2007-9-13 18:16:00
/************************************************************
    FileName: Gui.c

    Author:胡贵    

    Version :V1.0      

    Date: 2007.9.13

    Description:
        用于GUI的一些底层代码,只是部分功能,
        还需要完善

    History:

      <author>      <time>      <version >      <desc>


************************************************************/
#include "includes.h"
#undef GLOBAL
#include "GUI_ZIMU.H"


#include "global_variable.h"

/****************************************************
//coordinate base 0


//byte0 byte1 ...
//DB0   DB0  ...       bit0
//DB1   DB1  ...       bit1
//DB2   DB2  ...       bit2
//DB3   DB3  ...        .
//DB4   DB4  ...        .
//DB5   DB5  ...        .
//DB6   DB6  ...
//DB7   DB7  ...
*****************************************************/







/*********************************************************************
    Description:画点
    
    Input:

        x:x坐标
        y:y坐标
    
    Output:

    Return:

    Gloable:    
        DisBuffer[]:图形缓冲

    Calls:

    Called By:

    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DrawPixel(UINT8 x,UINT8 y)
{
    UINT16 Location_Byte;
    UINT8 Location_Bit;

    Location_Byte=(y/8)*X_PIXEL+x;
    Location_Bit=y%8;
    DisBuffer[Location_Byte]|=(0x01<<Location_Bit);
}


/*********************************************************************
    Description:画水平线,实线
    
    Input:

        x0:起点x坐标
        x1:终点x坐标
        y:y坐标
    
    Output:

    Return:

    Gloable:    
        DisBuffer[]:图形缓冲

    Calls:

    Called By:

    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DrawHLine(UINT8 x0,UINT8 x1,UINT8 y)
{
    //    000000XX    XXXXXXXX      ....        XXXXXXXX         XX000000            Location_Bit
    //             |                                                                    |
    //            |                                                                          |
    //          Location_Byte0                                                Location_Byte1
    UINT16 Location_Byte0,Location_Byte1;
    UINT8 Location_Bit;
    UINT16 i;
    //Location_Byte0=(y/8)*X_PIXEL+x0;
    //Location_Byte1=(y/8)*X_PIXEL+x1;
    Location_Byte0=(y/8)*(X_PIXEL)+x0;
    Location_Byte1=(y/8)*(X_PIXEL)+x1;
    Location_Bit=(y%8);

    for(i=Location_Byte0;i<=Location_Byte1;i++)
        DisBuffer[i]|=(0x01<<Location_Bit);
}



/*********************************************************************
    Description:画水平线,实线,反显,用于擦出区域调用
    
    Input:

        x0:起点x坐标
        x1:终点x坐标
        y:y坐标
    
    Output:

    Return:

    Gloable:    
        DisBuffer[]:图形缓冲

    Calls:

    Called By:
        Gui_Clearall();
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DrawHLine_(UINT8 x0,UINT8 x1,UINT8 y)
{
    //    000000XX    XXXXXXXX      ....        XXXXXXXX         XX000000            Location_Bit
    //             |                                                                    |
    //            |                                                                           |
    //          Location_Byte0                                                Location_Byte1
    UINT16 Location_Byte0,Location_Byte1;
    UINT8 Location_Bit;
    UINT16 i;
    //Location_Byte0=(y/8)*X_PIXEL+x0;
    //Location_Byte1=(y/8)*X_PIXEL+x1;
    Location_Byte0=(y/8)*(X_PIXEL)+x0;
    Location_Byte1=(y/8)*(X_PIXEL)+x1;
    Location_Bit=(y%8);

    for(i=Location_Byte0;i<=Location_Byte1;i++)
    {
        DisBuffer[i]&=(~(0x01<<Location_Bit));
//        uart0_send(DisBuffer[i]);
    }
//    Display();
    _nop_();
}



/*********************************************************************
    Description:画垂直线,实线
    
    Input:

        x0:起点x坐标
        x1:终点x坐标
        y:y坐标
    
    Output:

    Return:

    Gloable:    
        DisBuffer[]:图形缓冲

    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DrawVLine(UINT8 y0,UINT8 y1,UINT8 x)
{    
    //                  
    //                  0
    //                  0
    //                  0
    //                  0
    //                  0                                   } ----->Location_Byte0   
    //                  0
    //                  X -->Location_Bit0
    //                  X
    //
    //                  X
    //                  X
    //                  X
    //                  X
    //                  X
    //                  X
    //                  X
    //                  X
       //                  .
       //                  .
       //                  .
    //                  X
    //                  X --->Location_Bit1
    //                  0
    //                  0
    //                  0                                   }------->Location_Byte1
    //                  0
    //                  0
    //                  0
    UINT16 Location_Byte0,Location_Byte1;
    UINT8 Location_Bit0,Location_Bit1,temp=0;
    UINT16 i;
    Location_Byte0=(y0/8)*(X_PIXEL)+x;
    Location_Byte1=(y1/8)*(X_PIXEL)+x;
    Location_Bit0=(y0%8);
    Location_Bit1=(y1%8);

    if(Location_Byte0==Location_Byte1)
    {
        for(i=Location_Bit0;i<=Location_Bit1;i++)
            temp|=(0x01<<i);
        DisBuffer[Location_Byte0]|=temp;
    }
    else
    {
        for(i=Location_Byte0+X_PIXEL;i<=Location_Byte1-X_PIXEL;i+=X_PIXEL)
            DisBuffer[i]=0xff;
        DisBuffer[Location_Byte0]|=(0xff<<Location_Bit0);//(0x80>>(7-Location_Bit0));
        DisBuffer[Location_Byte1]|=(0xff>>(7-Location_Bit1));//~(0x80>>(7-Location_Bit1));//(0x01<<Location_Bit1);
    }
}



/*********************************************************************
    Description:画矩形,实线
    
    Input:

        x0:左上角x坐标
        x1:右下角x坐标
        y0:左上角y坐标
        y1:右下角y坐标
    
    Output:

    Return:

    Gloable:    
        DisBuffer[]:图形缓冲

    Calls:

    Called By:
        Gui_Clearall();
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DrawRect(UINT8 x0,UINT8 x1,UINT8 y0,UINT8 y1)
{
    GUI_DrawHLine(x0, x1,y0);
    GUI_DrawHLine(x0, x1,y1);
    GUI_DrawVLine(y0, y1, x0);
    GUI_DrawVLine(y0, y1, x1);
}



/*********************************************************************
    Description:获得字符字模指针(部分字符)
    
    Input:
        character:字符
    
    Output:

    Return:
        指向字符字模的指针

    Gloable:    
        hz_A:字模数组
        .
        .
        .

    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
UINT8 code* GetCharPointer(UINT8 character)
{
    UINT8 code *p;
    switch(character)
    {
        case 'A':p=hz_A;
            break;
        case 'P':p=hz_P;
            break;
        case 'S':p=hz_S;
            break;
        case 'I':p=hz_I;
            break;
        case 'D':p=hz_D;
            break;
        case 'H':p=hz_H;
            break;
        case 'O':p=hz_O;
            break;
        case 'V':p=hz_V;
            break;
        case 'R':p=hz_Run;
        //Write_UART_STRING("OK1");
            break;
        case 'T':p=hz_Stop;
        //Write_UART_STRING("OK2");
            break;
        case '0':p=hz_0_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '1':p=hz_1_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '2':p=hz_2_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '3':p=hz_3_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '4':p=hz_4_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '5':p=hz_5_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '6':p=hz_6_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '7':p=hz_7_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '8':p=hz_8_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        case '9':p=hz_9_;//+CharacterStyle*(hz_0_-hz_0);
            break;
        default:
            break;
    }
    return p;
}



/*********************************************************************
    Description:在确定位置显示一个字符串,字符块基点在左下角
    
    Input:
        x:字符块x坐标
        y:字符块y坐标
        p_Char:字符串指针
    Output:

    Return:

    Gloable:    
        struct GUI_RECT 矩形结构体
        Number_X_Pixel:字符的X方向上的像素
        Number_Y_Pixel:字符在Y方向上的像素

    Calls:
        Gui_CharacterStyle_Set7_4();设置字体7*4
        GUI_ClearRect();清除一片区域
        ZK_To_Bitmap();字模转成位图
        RegionInsertInDisBuffer();往缓冲插入一片区域

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DispChars(UINT8 *p_Char,UINT8 x,UINT8 y)
{
    UINT8 i,count;
    UINT8 xdata mid[72];
    struct GUI_RECT rect;
    count=strlen(p_Char);
//    Gui_CharacterStyle_Set7_4();
    GUI_ClearRect(x, x+Number_X_Pixel*count-1, y-Number_Y_Pixel+1, y);
    for(i=0;i<count;i++)
    {
        ZK_To_Bitmap(GetCharPointer(*p_Char++), Number_Y_Pixel, Number_X_Pixel, mid);
        rect.x0=x+i*Number_X_Pixel;
        rect.x1=rect.x0+Number_X_Pixel-1;
        rect.y0=y-Number_Y_Pixel+1;
        rect.y1=y;
        RegionInsertInDisBuffer(&rect, mid);
    }
//    Gui_CharacterStyle_Set12_6();
}
/*
void GUI_DispLine(struct Text *p_Text,UINT8 n_Disp,struct GUI_RECT *p_Rect)
{
    UINT8 i,mid[144];
    struct GUI_RECT rect;

    GUI_ClearRect(p_Rect->x0, p_Rect->x1, p_Rect->y0, p_Rect->y1);
    for(i=0;i<n_Disp;i++)
    {
        ZK_To_Bitmap(*(p_Text->p_Content+i), 12, 12, mid);
        rect.x0=p_Rect->x0+i*12;
        rect.x1=rect.x0+11;
        rect.y0=p_Rect->y0;
        rect.y1=p_Rect->y1;
        RegionInsertInDisBuffer(&rect,mid);
        PrintDisBuffer_();
    }
}*/




/*********************************************************************
    Description:整屏幕输出一副位图X_PIXEL*Y_PIXEL
    
    Input:
        p_BMP:位图字模指针
    
    Output:

    Return:

    Gloable:    
        DisBuffer[]:图形缓冲

    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DispBMP(UINT8 code *p_BMP)
{
    UINT16 i;
    for(i=0;i<488;i++)
        DisBuffer[i]=*p_BMP++;
}




/*********************************************************************
    Description:显示整数,坐标基点在左下角
    
    Input:
        dat:需要显示的整数
        x:x 坐标
        y:y坐标
        formate:格式化方式
    Output:

    Return:

    Gloable:    
        struct GUI_RECT 矩形结构体
        Number_X_Pixel:字符的X方向上的像素
        Number_Y_Pixel:字符在Y方向上的像素
        Addr_Base:数字字模段起始地址
        Addr_Deviate:数字字模偏移量,即字模字节数

    Calls:
        GUI_ClearRect();清除一片区域
        ZK_To_Bitmap();字模转成位图
        RegionInsertInDisBuffer();往缓冲插入一片区域
        pow_10();求幂

    Called By:
        
    Others:
        注意数值范围,目前定义的是16 bit

    Modify Record:
    
*********************************************************************/
void GUI_DisIntData(INT16 dat,UINT8 x,UINT8 y,UINT8 *formate)
{
    UINT8 xdata buf[10],BufLen,i;
    UINT8 xdata mid[72];
    struct GUI_RECT rect;

    rect.x0=x;
    rect.y0=y-Number_Y_Pixel+1;
    rect.y1=y;
    
    sprintf(buf,formate,dat);
    BufLen = strlen(buf);
    GUI_ClearRect(x, x+Number_X_Pixel*BufLen-1, y-Number_Y_Pixel + 1, y);
    for (i = 0; i < BufLen; i++)
    {
        if (buf[i] == '-')
        {
        GUI_DrawHLine(rect.x0, rect.x0+Number_X_Pixel-1, rect.y0-Number_Y_Pixel/2);
                rect.x0+=Number_X_Pixel;
        }
        else
        {
            ZK_To_Bitmap(Addr_Base + Addr_Deviate * (buf[i]-'0'), Number_Y_Pixel, Number_X_Pixel, mid);
            rect.x1=rect.x0+Number_X_Pixel-1;
            RegionInsertInDisBuffer(&rect, mid);
            rect.x0=rect.x0+Number_X_Pixel;
        }
    }
}




/*********************************************************************
    Description:显示整数,坐标基点在左下角
    
    Input:
        dat:需要显示的整数
        x:x 坐标
        y:y坐标
        formate:格式化方式
    Output:

    Return:

    Gloable:    
        Number_X_Pixel:字符的X方向上的像素
        Number_Y_Pixel:字符在Y方向上的像素
        special:特殊处理,这是一个设计的局限性,需要在下一个版本中改进

    Calls:
        pow_10();求幂
        GUI_DisIntData();显示整数
        GUI_DrawPixel();画点

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DisFloatData(FLP32 dat,UINT8 x,UINT8 y,UINT8 *formate)
{
    UINT8 xdata buf[10],BufLen,i;
    UINT8 xdata mid[72];
    struct GUI_RECT rect;

    rect.x0=x;
    rect.y0=y-Number_Y_Pixel+1;
    rect.y1=y;

    
    sprintf(buf,formate,dat);
    BufLen = strlen(buf);
    GUI_ClearRect(x, x+Number_X_Pixel*BufLen-1-(Number_X_Pixel - Number_Dot_Pixel), y-Number_Y_Pixel + 1, y);
    for (i = 0; i < BufLen; i++)
    {
        if (buf[i] == '.')//only one pixel
        {
            GUI_DrawPixel(rect.x0,rect.y1-Number_Dot_Pixel_Y);
            rect.x0+=2;
        }
        else
        {
            if (buf[i] == '-')
            {
                GUI_DrawHLine(rect.x0, rect.x0+Number_X_Pixel-1, rect.y0-Number_Y_Pixel/2);
                rect.x0+=Number_X_Pixel;
            }
            else
            {
                ZK_To_Bitmap(Addr_Base + Addr_Deviate * (buf[i]-'0'), Number_Y_Pixel, Number_X_Pixel, mid);
                rect.x1=rect.x0+Number_X_Pixel-1;
                RegionInsertInDisBuffer(&rect, mid);
                rect.x0=rect.x0+Number_X_Pixel;
            }
        }
    }
}



/*********************************************************************
    Description:显示区域反转
    
    Input:
        x0:左上角x坐标
        x1:右下角x坐标
        y0:左上角y坐标
        y1:右下角y坐标
    Output:

    Return:

    Gloable:    
        Number_X_Pixel:字符的X方向上的像素
        Number_Y_Pixel:字符在Y方向上的像素
        special:特殊处理,这是一个设计的局限性,需要在下一个版本中改进
        DisBuffer[]:图形缓冲
    Calls:
        

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_InvertRect(UINT8 x0,UINT8 x1,UINT8 y0,UINT8 y1)
{
    UINT8 i,j,Location_Bit;
    UINT16 Location_Byte;

    //for(i=x0;i<=x1-5;i++)// 不怎么严谨
    for(i=x0;i<=x1;i++)
        for(j=y0;j<=y1;j++)
        {
            Location_Byte=(j/8)*X_PIXEL+i;
            Location_Bit=j%8;
            if((DisBuffer[Location_Byte]>>Location_Bit)&0x01)
                DisBuffer[Location_Byte]&=(~(0x01<<Location_Bit));
            else
                DisBuffer[Location_Byte]|=(0x01<<Location_Bit);
        }
}



/*********************************************************************
    Description:清除区域
    
    Input:
        x0:左上角x坐标
        x1:右下角x坐标
        y0:左上角y坐标
        y1:右下角y坐标
    Output:

    Return:

    Gloable:    
        
    Calls:
        GUI_DrawHLine_();画线,反色

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_ClearRect(UINT8 x0,UINT8 x1,UINT8 y0,UINT8 y1)
{
    UINT8 i;
    for(i=y0;i<=y1;i++)
    {
        GUI_DrawHLine_(x0, x1,i);
//        Display();
    }
}



/*********************************************************************
    Description:像素值转成字节表示(0x00,0x01),这样编程简单,不过此方式需要改变。
    
    Input:
        row:字模行数
        col:字模列数
        zk:字模指针
    Output:
        p_Bitmap:转换结果存放区域指针
    Return:

    Gloable:    
        
    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void ZK_To_Bitmap(UINT8 code* zk,UINT8 row,UINT8 col,UINT8* p_Bitmap)
{
    UINT8 i,j,Byte_ZK,Bit_Byte;
    for(j=0;j<col;j++)
        for(i=0;i<row;i++)
        {
            Byte_ZK=j*(row/8+1)+i/8;//(i*((col-1)/8+1)+j/8);
            Bit_Byte=i%8;
//            if((zk[(i*((col-1)/8+1)+j/8)]<<(j%8))==0x80)
            if(((zk[Byte_ZK]>>Bit_Byte)&0x01))
                *p_Bitmap++=1;
            else
                *p_Bitmap++=0;
        }
}
/*
//汉字的基准在左下角
void HZInsertInDis(UINT8 *p_HZ,UINT8 Pixel_X,UINT8 Pixel_Y,UINT8 x,UINT8 y)
{
    UINT8 temp[144],i;
    for(i=0;i<144;i++)
        if()
}*/



/*********************************************************************
    Description:显示信息插入显示缓冲。
    
    Input:
        rect:区域位置,和内容相对应
        p_Content:显示内容,横排,字节标识像素值(0x00,0x01)
    Output:
        p_Bitmap:转换结果存放区域指针
    Return:

    Gloable:    
        DisBuffer[]:显示缓冲
    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void RegionInsertInDisBuffer(struct GUI_RECT* rect,UINT8* p_Content)
{
    UINT8 i,j;
    UINT16 Byte_Buffer,Bit_Byte;
    for(j=rect->x0;j<=rect->x1;j++)
    {    for(i =rect->y0;i<=rect->y1;i++)
        {
            Byte_Buffer=(i/8)*X_PIXEL+j;//(i-1)*16+(j-1)/8;
            Bit_Byte=(i%8);//(j-1)%8;
            if((*p_Content++)==1)
                DisBuffer[Byte_Buffer]|=(0x01<<Bit_Byte);
            else
                DisBuffer[Byte_Buffer]&=(~(0x01<<Bit_Byte));            
        }
    }
}






/*********************************************************************
    Description:获取汉字内码,汉字有两个字节表示
    
    Input:
        p:单个汉字指针
        
    Output:
        
    Return:
        两字节的汉字内码
    Gloable:    
    
    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
unsigned int get_hz_const(UINT8 *p)
{
     unsigned int const_;
     const_=*p++;
     const_<<=8;
     const_|=*p++;
     return const_;
}



/*********************************************************************
    Description:获取汉字串的字模表示
    
    Input:
        p:汉字串
        
    Output:
        HZ_Group:指向字模指针的指针,即存放汉字串中所有汉字字模指针的数组
    Return:
        两字节的汉字内码
    Gloable:    
    
    Calls:
        get_hz_const();获取汉字内码。
    Called By:
        
    Others:
        考虑到效率的问题,此函数当中的查找判断需要做优化,方法是做成顺序表。
    Modify Record:
    
*********************************************************************/
UINT8 Generate_HZ_Group(UINT8 *p,UINT8 code **HZ_Group)
{
    UINT8 n_HZ=0;
    UINT8 *q;
    UINT8 i;
    unsigned int const_mid=0;//mid;

    q=p;
    while((*q++)!=0x00)
         n_HZ++;
    n_HZ>>=1;
    for(i=0;i<n_HZ;i++)
    {    
        const_mid=*p++;
        const_mid<<=8;
        const_mid|=*p++;
        

        if(const_mid==get_hz_const("等"))
            *HZ_Group++=hz_deng;
        else
        if(const_mid==get_hz_const("待"))
            *HZ_Group++=hz_dai;
        else
        if(const_mid==get_hz_const("完"))
            *HZ_Group++=hz_wan;
        else
        if(const_mid==get_hz_const("成"))
            *HZ_Group++=hz_cheng_gong;
        else
        if(const_mid==get_hz_const("测"))
            *HZ_Group++=hz_ce;
        else
        if(const_mid==get_hz_const("量"))
            *HZ_Group++=hz_liang;
        else
        if(const_mid==get_hz_const("设"))
            *HZ_Group++=hz_she;
        else
        if(const_mid==get_hz_const("置"))
            *HZ_Group++=hz_zhi;
        else
        if(const_mid==get_hz_const("存"))
            *HZ_Group++=hz_cun;
        else
        if(const_mid==get_hz_const("储"))
            *HZ_Group++=hz_chu_cun;
        else
        if(const_mid==get_hz_const("时"))
            *HZ_Group++=hz_shi;
        else
        if(const_mid==get_hz_const("间"))
            *HZ_Group++=hz_jian_xie;
        else
        if(const_mid==get_hz_const("通"))
            *HZ_Group++=hz_tong;
        else
        if(const_mid==get_hz_const("信"))
            *HZ_Group++=hz_xin;
        else
        if(const_mid==get_hz_const("仪"))
            *HZ_Group++=hz_yi;
        else
        if(const_mid==get_hz_const("表"))
            *HZ_Group++=hz_biao;
        else
        if(const_mid==get_hz_const("校"))
            *HZ_Group++=hz_jiao;
        else
        if(const_mid==get_hz_const("正"))
            *HZ_Group++=hz_zheng;
        else
        if(const_mid==get_hz_const("试"))
            *HZ_Group++=hz_shi_juan;
        else
        if(const_mid==get_hz_const("件"))
            *HZ_Group++=hz_jian;
        else
        if(const_mid==get_hz_const("模"))
            *HZ_Group++=hz_mo;
        else
        if(const_mid==get_hz_const("式"))
            *HZ_Group++=hz_shi_yang;
        else
        if(const_mid==get_hz_const("峰"))
            *HZ_Group++=hz_feng;
        else
        if(const_mid==get_hz_const("值"))
            *HZ_Group++=hz_zhi_ri;
        else
        if(const_mid==get_hz_const("停"))
            *HZ_Group++=hz_ting;
        else
        if(const_mid==get_hz_const("留"))
            *HZ_Group++=hz_liu;
        else
        if(const_mid==get_hz_const("阈"))
            *HZ_Group++=hz_yu;
        else
        if(const_mid==get_hz_const("报"))
            *HZ_Group++=hz_bao;
        else
        if(const_mid==get_hz_const("警"))
            *HZ_Group++=hz_jing;
        else
        if(const_mid==get_hz_const("截"))
            *HZ_Group++=hz_jie;
        else
        if(const_mid==get_hz_const("面"))
            *HZ_Group++=hz_mian;
        else
        if(const_mid==get_hz_const("打"))
            *HZ_Group++=hz_da;
        else
        if(const_mid==get_hz_const("印"))
            *HZ_Group++=hz_yin;
        else
        if(const_mid==get_hz_const("方"))
            *HZ_Group++=hz_fang;
        else
        if(const_mid==get_hz_const("数"))
            *HZ_Group++=hz_shu;
        else
        if(const_mid==get_hz_const("据"))
            *HZ_Group++=hz_ju;
        else
        if(const_mid==get_hz_const("查"))
            *HZ_Group++=hz_cha;
        else
        if(const_mid==get_hz_const("询"))
            *HZ_Group++=hz_xun;
        else
        if(const_mid==get_hz_const("清"))
            *HZ_Group++=hz_qing;
        else
        if(const_mid==get_hz_const("除"))
            *HZ_Group++=hz_chu;
        else
        if(const_mid==get_hz_const("分"))
            *HZ_Group++=hz_fen;
        else
        if(const_mid==get_hz_const("秒"))
            *HZ_Group++=hz_miao;
        else
        if(const_mid==get_hz_const("年"))
            *HZ_Group++=hz_nian;
        else
        if(const_mid==get_hz_const("月"))
            *HZ_Group++=hz_yue;
        else
        if(const_mid==get_hz_const("日"))
            *HZ_Group++=hz_ri;
        else
        if(const_mid==get_hz_const("波"))
            *HZ_Group++=hz_bo;
        else
        if(const_mid==get_hz_const("特"))
            *HZ_Group++=hz_te;
        else
        if(const_mid==get_hz_const("率"))
            *HZ_Group++=hz_lv;
        else
        if(const_mid==get_hz_const("地"))
            *HZ_Group++=hz_di;
        else
        if(const_mid==get_hz_const("址"))
            *HZ_Group++=hz_zhi_di;
        else
        if(const_mid==get_hz_const("/u"))
            *HZ_Group++=symbol_u;
        else
        if(const_mid==get_hz_const("/d"))
            *HZ_Group++=symbol_d;
        else
//new added

        if(const_mid==get_hz_const("三"))
            *HZ_Group++=hz_san;
                else
        if(const_mid==get_hz_const("思"))
            *HZ_Group++=hz_si;
                else
        if(const_mid==get_hz_const("行"))
            *HZ_Group++=hz_xing;
                else
        if(const_mid==get_hz_const("控"))
            *HZ_Group++=hz_kong;
                else
        if(const_mid==get_hz_const("联"))
            *HZ_Group++=hz_lian;
                else
        if(const_mid==get_hz_const("系"))
            *HZ_Group++=hz_xi;
                else
        if(const_mid==get_hz_const("电"))
            *HZ_Group++=hz_dian;
                else
        if(const_mid==get_hz_const("话"))
            *HZ_Group++=hz_hua;
                else
        if(const_mid==get_hz_const("实"))
            *HZ_Group++=hz_shi_ji;
                else
        if(const_mid==get_hz_const("速"))
            *HZ_Group++=hz_su_lv;
                else
        if(const_mid==get_hz_const("压"))
            *HZ_Group++=hz_ya;
                else
        if(const_mid==get_hz_const("力"))
            *HZ_Group++=hz_li;
                else
        if(const_mid==get_hz_const("机"))
            *HZ_Group++=hz_ji_qi;
                else
        if(const_mid==get_hz_const("欢"))
            *HZ_Group++=hz_huan;
                else
        if(const_mid==get_hz_const("迎"))
            *HZ_Group++=hz_ying;
                else
        if(const_mid==get_hz_const("使"))
            *HZ_Group++=hz_shi_yong;
                else
        if(const_mid==get_hz_const("用"))
            *HZ_Group++=hz_yong;
                else
        if(const_mid==get_hz_const("是"))
            *HZ_Group++=hz_shi_fou;
                else
        if(const_mid==get_hz_const("否"))
            *HZ_Group++=hz_fou;
                else
        if(const_mid==get_hz_const("请"))
            *HZ_Group++=hz_qing_shi;
                else
        if(const_mid==get_hz_const("输"))
            *HZ_Group++=hz_shu_ru;
                else
        if(const_mid==get_hz_const("入"))
            *HZ_Group++=hz_ru;
                else
        if(const_mid==get_hz_const("自"))
            *HZ_Group++=hz_zi;
                else
        if(const_mid==get_hz_const("动"))
            *HZ_Group++=hz_dong;
        else
        if(const_mid==get_hz_const("全"))
            *HZ_Group++=hz_quan;
        else
        if(const_mid==get_hz_const("部"))
            *HZ_Group++=hz_bu;

        else
        if(const_mid==get_hz_const("密"))
            *HZ_Group++=hz_mi;
        else
        if(const_mid==get_hz_const("码"))
            *HZ_Group++=hz_ma;
        else
        if(const_mid==get_hz_const("两"))
            *HZ_Group++=hz_liang_dian;
        else
        if(const_mid==get_hz_const("多"))
            *HZ_Group++=hz_duo;
        else
        if(const_mid==get_hz_const("点"))
            *HZ_Group++=hz_dian_di;
        else
        if(const_mid==get_hz_const("修"))
            *HZ_Group++=hz_xiu;
        else
        if(const_mid==get_hz_const("改"))
            *HZ_Group++=hz_gai;
        else
        if(const_mid==get_hz_const("新"))
            *HZ_Group++=hz_xin_niang;
        else
        if(const_mid==get_hz_const("隔"))
            *HZ_Group++=hz_ge;
        else
        if(const_mid==get_hz_const("统"))
            *HZ_Group++=hz_tong_ji;
        else
        if(const_mid==get_hz_const("复"))
            *HZ_Group++=hz_fu;
        else
        if(const_mid==get_hz_const("位"))
            *HZ_Group++=hz_wei;

        else
        if(const_mid==get_hz_const("重"))
            *HZ_Group++=hz_chong;
        else
        if(const_mid==get_hz_const("上"))
            *HZ_Group++=hz_shang;
        else
        if(const_mid==get_hz_const("电"))
            *HZ_Group++=hz_dian_yuan;
        else
        if(const_mid==get_hz_const("零"))
            *HZ_Group++=hz_ling;
        else
        if(const_mid==get_hz_const("满"))
            *HZ_Group++=hz_man;
        else
        if(const_mid==get_hz_const("程"))
            *HZ_Group++=hz_cheng;
        else
        if(const_mid==get_hz_const("编"))
            *HZ_Group++=hz_bian;
        else
        if(const_mid==get_hz_const("号"))
            *HZ_Group++=hz_hao;
        else
        if(const_mid==get_hz_const("无"))
            *HZ_Group++=hz_wu;
        else
        if(const_mid==get_hz_const("效"))
            *HZ_Group++=hz_xiao;
        else

        if(const_mid==get_hz_const("低"))
            *HZ_Group++=hz_di_wa;
        else
        if(const_mid==get_hz_const("砌"))
            *HZ_Group++=hz_qi;
        else
        if(const_mid==get_hz_const("体"))
            *HZ_Group++=hz_ti;
        else
        if(const_mid==get_hz_const("原"))
            *HZ_Group++=hz_yuan;
        else
        if(const_mid==get_hz_const("小"))
            *HZ_Group++=hz_xiao_shu;
        else
        if(const_mid==get_hz_const("型"))
            *HZ_Group++=hz_xing_hao;
        else
        if(const_mid==get_hz_const("数"))
            *HZ_Group++=hz_shu_ju;
        else
        if(const_mid==get_hz_const("显"))
            *HZ_Group++=hz_xian;
        else
        if(const_mid==get_hz_const("抗"))
            *HZ_Group++=hz_kang;
        else
        if(const_mid==get_hz_const("折"))
            *HZ_Group++=hz_zhe;
        else
        if(const_mid==get_hz_const("管"))
            *HZ_Group++=hz_guan;
        else
        if(const_mid==get_hz_const("理"))
            *HZ_Group++=hz_li_lun;
        else
        if(const_mid==get_hz_const("所"))
            *HZ_Group++=hz_suo;
        else
        if(const_mid==get_hz_const("选"))
            *HZ_Group++=hz_xuan;
        else
        if(const_mid==get_hz_const("项"))
            *HZ_Group++=hz_xiang;
        else
        if(const_mid==get_hz_const("查"))
            *HZ_Group++=hz_cha_kan;
        else
        if(const_mid==get_hz_const("看"))
            *HZ_Group++=hz_kan;
        else
        if(const_mid==get_hz_const("恢"))
            *HZ_Group++=hz_hui;
        else
        if(const_mid==get_hz_const("出"))
            *HZ_Group++=hz_chu_chang;
        else
        if(const_mid==get_hz_const("厂"))
            *HZ_Group++=hz_chang;
        else
        if(const_mid==get_hz_const("索"))
            *HZ_Group++=hz_suo_yin;
        else
        if(const_mid==get_hz_const("引"))
            *HZ_Group++=hz_yin_hao;
        else
        if(const_mid==get_hz_const("确"))
            *HZ_Group++=hz_que;
        else
        if(const_mid==get_hz_const("认"))
            *HZ_Group++=hz_ren;
        else
        if(const_mid==get_hz_const("息"))
            *HZ_Group++=hz_xi_nu;
        else
        if(const_mid==get_hz_const("定"))
            *HZ_Group++=hz_ding;
        else
        if(const_mid==get_hz_const("退"))
            *HZ_Group++=hz_tui;
        else
        if(const_mid==get_hz_const("出"))
            *HZ_Group++=hz_chu_ru;
        else
        if(const_mid==get_hz_const("向"))
            *HZ_Group++=hz_xiang_xia;
        else
        if(const_mid==get_hz_const("下"))
            *HZ_Group++=hz_xia;
        else
        if(const_mid==get_hz_const("左"))
            *HZ_Group++=hz_zuo;
        else
        if(const_mid==get_hz_const("右"))
            *HZ_Group++=hz_you;
        else
        if(const_mid==get_hz_const("增"))
            *HZ_Group++=hz_zeng;
        else
        if(const_mid==get_hz_const("加"))
            *HZ_Group++=hz_jia;
        else
        if(const_mid==get_hz_const("移"))
            *HZ_Group++=hz_yi_wei;
        else
        if(const_mid==get_hz_const("空"))
            *HZ_Group++=hz_kong_kong;
        else
        if(const_mid==get_hz_const("终"))
            *HZ_Group++=hz_zhong;
        else
        if(const_mid==get_hz_const("止"))
            *HZ_Group++=hz_zhi_bu;
        else
        if(const_mid==get_hz_const("功"))
            *HZ_Group++=hz_gong;

    }
    return n_HZ;
}

* - 本贴最后修改时间:2007-9-13 18:21:30 修改者:原野之狼


原野之狼 发布于 2007-9-13 18:17:00
/*********************************************************************
    Description:显示汉字串
    
    Input:
        p_HZ_Str:汉字串指针
        x:汉字串x坐标
        y:汉字串y坐标
    Output:
        
    Return:
        两字节的汉字内码
    Gloable:    
    
    Calls:
        Generate_HZ_Group();获取汉字串的字模表示
        ZK_To_Bitmap();字库到位图标识
        RegionInsertInDisBuffer();显示数据插入到显存
        GUI_ClearRect();清除区域
        
    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
UINT8 GUI_DispLine_(UINT8 *p_HZ_Str,UINT8 x,UINT8 y)
{
    UINT8 xdata mid[144];
//    const UINT8 *p_hz[10];
    UINT8 code* p_hz[10];
    UINT8 n_hz,i;
    struct GUI_RECT rect;
    
    n_hz=Generate_HZ_Group(p_HZ_Str, p_hz);
    GUI_ClearRect(x, x+12*n_hz-1,y-11,y );
    for(i=0;i<n_hz;i++)
    {
        ZK_To_Bitmap(*(p_hz+i), 12, 12, mid);
        rect.x0=x+i*12;
        rect.x1=rect.x0+11;
        rect.y0=y-11;
        rect.y1=y;
        RegionInsertInDisBuffer(&rect,mid);
    }
    return n_hz;
}



/*********************************************************************
    Description:画上三角和下三角
    
    Input:
        up_down:0x01up  0x00down
    Output:
        
    Return:
        
    Gloable:    
    
    Calls:
        
    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DrawArrow(UINT8 up_down)
{
    if(up_down==0x01)
        GUI_DispLine_("/u", 110, 15);
    else
        GUI_DispLine_("/d", 110, 30);
}



/*********************************************************************
    Description:清缓冲
    
    Input:

    Output:
        
    Return:
    
    Gloable:    
    
    Calls:
    
    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_ClearAll(void)
{
    UINT16 i;
    for(i=0;i<128*8;i++)
        DisBuffer[i]=0;
}




/*********************************************************************
    Description:设置数字字体12*6,
        设置全局变量:字体字模基址,偏移,X,Y方向像素个数
    
    Input:
    
    Output:
        
    Return:
        
    Gloable:    
        Number_X_Pixel:x方向像素
        Number_Y_Pixel:y方向上的像素
        CharacterStyle:字体类型
        Addr_Base:字体字模基址
        Addr_Deviate:字体字模偏移
        hz_1_:数字1
        hz_0_:数字0
    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void Gui_CharacterStyle_Set7_4(void)
{
    Number_X_Pixel=4;
    Number_Y_Pixel=7;
    CharacterStyle=0;
    Addr_Base=hz_0;
    Addr_Deviate=hz_1-hz_0;
    Number_Dot_Pixel=2;
    Number_Dot_Pixel_Y=1;
}



/*********************************************************************
    Description:设置数字字体12*6,
        设置全局变量:字体字模基址,偏移,X,Y方向像素个数
    
    Input:
    
    Output:
        
    Return:
        
    Gloable:    
        Number_X_Pixel:x方向像素
        Number_Y_Pixel:y方向上的像素
        CharacterStyle:字体类型
        Addr_Base:字体字模基址
        Addr_Deviate:字体字模偏移
        hz_1_:数字1
        hz_0_:数字0
    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void Gui_CharacterStyle_Set12_6(void)
{
    Number_X_Pixel=6;
    Number_Y_Pixel=12;
    CharacterStyle=1;
    Addr_Base=hz_0_;
    Addr_Deviate=hz_1_-hz_0_;
    Number_Dot_Pixel=2;
    Number_Dot_Pixel_Y=2;
}


/*********************************************************************
    Description:
        绘制按钮
    
    Input:
        p_btn:按钮指针
        p_HZ_Str:按钮文字
        x:按钮位置X坐标
        y:按钮位置Y坐标
        dx:按钮宽度
        dy:按钮高度
    
    Output:
        
    Return:
        
    Gloable:    

    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_DrawButton(struct GUI_BUTTON *p_btn, UINT8 *p_HZ_Str,UINT8 x,UINT8 y,UINT8 dx,UINT8 dy)
{
    struct GUI_RECT rect;

    p_btn->x = x;
    p_btn->y = y;
    p_btn->dx = dx;
    p_btn->dy = dy;
    p_btn->p_HZ_STR = p_HZ_Str;
    
    rect.x0 = x;
    rect.x1 = x + dx - 1;
    rect.y0 = y - dy + 1;
    rect.y1 = y;    

    GUI_ClearRect(rect.x0, rect.x1 + 1, rect.y0, rect.y1 + 1);
    GUI_DrawRect(rect.x0, rect.x1, rect.y0, rect.y1);
    GUI_ClearPixel(rect.x0, rect.y0);
    GUI_ClearPixel(rect.x1, rect.y0);
    GUI_DrawHLine(rect.x0 + 2, rect.x1 + 1, rect.y1 + 1);
    GUI_DrawVLine(rect.y0 + 2, rect.y1, rect.x1 + 1);
    GUI_DispLine_(p_HZ_Str, rect.x0 + 2, rect.y1 - 1);
}


/*********************************************************************
    Description:
        绘制按钮按下的效果
    
    Input:
        p_btn:按钮指针
    
    Output:
        
    Return:
        
    Gloable:    

    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_ButtonClick(struct GUI_BUTTON *p_btn)
{
    struct GUI_RECT rect;
    
    rect.x0 = p_btn->x;
    rect.x1 = p_btn->x + p_btn->dx - 1;
    rect.y0 = p_btn->y - p_btn->dy + 1;
    rect.y1 = p_btn->y;
    
    GUI_ClearRect(rect.x0, rect.x1 + 1, rect.y0, rect.y1 + 1);
    GUI_DrawRect(rect.x0 + 1, rect.x1 + 1, rect.y0 + 1, rect.y1 + 1);
    GUI_ClearPixel(rect.x0 + 1, rect.y0 + 1);
    GUI_ClearPixel(rect.x1 + 1, rect.y0 + 1);
    GUI_DispLine_(p_btn->p_HZ_STR, rect.x0 + 3, rect.y1);
    
    Display();
}


/*********************************************************************
    Description:
        绘制按钮释放的效果
    
    Input:
        p_btn:按钮指针
    
    Output:
        
    Return:
        
    Gloable:    

    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_ButtonRelease(struct GUI_BUTTON *p_btn)
{
    struct GUI_RECT rect;
    
    rect.x0 = p_btn->x;
    rect.x1 = p_btn->x + p_btn->dx - 1;
    rect.y0 = p_btn->y - p_btn->dy + 1;
    rect.y1 = p_btn->y;
    
    GUI_ClearRect(rect.x0, rect.x1 + 1, rect.y0, rect.y1 + 1);
    GUI_DrawRect(rect.x0, rect.x1, rect.y0, rect.y1);
    GUI_ClearPixel(rect.x0, rect.y0);
    GUI_ClearPixel(rect.x1, rect.y0);
    GUI_DrawHLine(rect.x0 + 2, rect.x1 + 1, rect.y1 + 1);
    GUI_DrawVLine(rect.y0 + 2, rect.y1, rect.x1 + 1);
    GUI_DispLine_(p_btn->p_HZ_STR, rect.x0 + 2, rect.y1 - 1);
    Display();
}


/*********************************************************************
    Description:
        清除一个点
    
    Input:
        x:X坐标
        y:Y坐标
    
    Output:
        
    Return:
        
    Gloable:    

    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void GUI_ClearPixel(UINT8 x,UINT8 y)
{
    UINT16 Location_Byte;
    UINT8 Location_Bit;

    Location_Byte = (y / 8) * 128 + x;
    Location_Bit = y % 8;
    DisBuffer[Location_Byte] &= (~(0x01 << Location_Bit));
}




/*********************************************************************
    Description:创建一个年月日时分秒设置页,YYMMDDHHMMSS
    
    Input:
        p_HZ_Str:标签
        p_T:时间结构体变量指针
        x_HZ:汉字标签X坐标
        y_HZ:汉字标签Y坐标
        x_T:时间值X坐标
        y_T:时间值Y坐标
        flag: 0x01YYMMDD 0x00HHMMSS
    Output:
        
    Return:
        
    Gloable:    
        struct StpLabelBlk_YMD:年月日时分秒标签页设置数据结构
        p_S_L_B: 无类型指针
        heap:自定义堆内存
    Calls:
        GUI_ClearAll();
        GUI_DispLine_();
        GUI_InvertRect();
        Gui_CharacterStyle_Set12_6();
        BCD2INT_TIME();
        Refresh_YMD();
    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void CreateStpLabel_YMD(UINT8 *p_HZ_Str,UINT8 x_HZ,UINT8 y_HZ,struct Time *p_T, UINT8 x_T,UINT8 y_T,UINT8 flag)
{
    struct StpLabelBlk_YMD* p;
    struct Time mid;
    
    GUI_ClearRect(2,     124, 1, 40);
    Gui_CharacterStyle_Set12_6();
    GUI_DispLine_(p_HZ_Str, x_HZ, y_HZ);
    
//    p_S_L_B=malloc(sizeof(struct StpLabelBlk_YMD));
    p_S_L_B=heap;
    p=(struct StpLabelBlk_YMD*)p_S_L_B;
    
    p->Location_Cur_Crt=0;
    p->p_Time=p_T;
    p->x=x_T;
    p->y=y_T;
//    BCD2INT_TIME(p->p_Time, &mid);
    mid.year=7;
    mid.mon=1;
    mid.date=1;
    mid.hour=0;
    mid.min=0;
    mid.sec=0;
    if(flag)//year mon date
    {
        p->Time_Temp.year=mid.year;
        p->Time_Temp.mon=mid.mon;
        p->Time_Temp.date=mid.date;
    }
    else
    {
        p->Time_Temp.hour=mid.hour;
        p->Time_Temp.min=mid.min;
        p->Time_Temp.sec=mid.sec;
    }
    Refresh_YMD(p,flag);
//    GUI_InvertRect(x_T-1,x_T+(X_PIXEL_NUMBER+1)*2, y_T-Y_PIXEL_NUMBER, y_T+1);    
}



/*********************************************************************
    Description://shift
        响应YYMMDDHHMMSS设置页确定键
        
    Input:
        flag:1 YYMMDD 0 HHMMSS
    Output:
        
    Return:
        
    Gloable:    
        p_S_L_B:    全局无类型指针    
        StpLabelBlk_YMD:YYMMDDHHMMSS设置页结构
    Calls:
        DS1302_Init():
    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void OnOK_YMD(UINT8 flag)
{
    struct StpLabelBlk_YMD*p;
    UINT8 mid1,mid2;
    p=(struct StpLabelBlk_YMD*)p_S_L_B;
    if(flag)//YY MM DD
    {
        mid1=(p->Time_Temp.year/10)*16;
        mid2=p->Time_Temp.year%10;
        p->p_Time->year=mid1+mid2;
        mid1=(p->Time_Temp.mon/10)*16;
        mid2=p->Time_Temp.mon%10;
        p->p_Time->mon=mid1+mid2;
        mid1=(p->Time_Temp.date/10)*16;
        mid2=p->Time_Temp.date%10;
        p->p_Time->date=mid1+mid2;
    }
    else
    {
        mid1=(p->Time_Temp.hour/10)*16;
        mid2=p->Time_Temp.hour%10;
        p->p_Time->hour=mid1+mid2;
        mid1=(p->Time_Temp.min/10)*16;
        mid2=p->Time_Temp.min%10;
        p->p_Time->min=mid1+mid2;
        mid1=(p->Time_Temp.sec/10)*16;
        mid2=p->Time_Temp.sec%10;
        p->p_Time->sec=mid1+mid2;
    }
    DS1302_Init();
}



/*********************************************************************
    Description://shift
        响应YYMMDDHHMMSS设置页增加键
        
    Input:
        flag:1 YYMMDD 0 HHMMSS
    Output:
        
    Return:
        
    Gloable:    
        p_S_L_B:    全局无类型指针    
        StpLabelBlk_YMD:YYMMDDHHMMSS设置页结构
    Calls:
        Refresh_YMD():
    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void OnPre_YMD(UINT8 flag)
{
    struct StpLabelBlk_YMD*p;
    p=(struct StpLabelBlk_YMD*)p_S_L_B;
    if(flag)//yy mm dd
    {
        switch(p->Location_Cur_Crt)
        {
            case 0:
            {
                (p->Time_Temp.year)++;
                p->Time_Temp.year%=100;
            }
                break;
            case 1:
            {
                if((++p->Time_Temp.mon)==13)
                    p->Time_Temp.mon=1;
            }
                break;
            case 2:
            {
                if(++(p->Time_Temp.date)==32)
                    p->Time_Temp.date=1;
            }
                break;
            default:;
        }
    }
    else
    {
        switch(p->Location_Cur_Crt)
        {
            case 0:
            {
                (p->Time_Temp.hour)++;
                p->Time_Temp.hour%=24;
            }
                break;
            case 1:
            {
                (p->Time_Temp.min)++;
                p->Time_Temp.min%=60;
            }
                break;
            case 2:
            {
                (p->Time_Temp.sec)++;
                p->Time_Temp.sec%=60;
            }
                break;
            default:;
        }
    }
    Refresh_YMD(p, flag);
}



/*********************************************************************
    Description://shift
        响应YYMMDDHHMMSS设置页移位键
        
    Input:
        flag: 1 YYMMDD 0 HHMMSS
    Output:
        
    Return:
        
    Gloable:    
        p_S_L_B:    全局无类型指针    
        StpLabelBlk_YMD:YYMMDDHHMMSS设置页结构
    Calls:
        Refresh_YMD():
    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void OnNxt_YMD(UINT8 flag)
{
    struct StpLabelBlk_YMD *p;
    p=(struct StpLabelBlk_YMD *)p_S_L_B;

    p->Location_Cur_Crt++;
    p->Location_Cur_Crt%=3;

    Refresh_YMD(p, flag);
}


/*********************************************************************
    Description:
        响应YYMMDDHHMMSS设置页退出键
        
    Input:
        
    Output:
        
    Return:
        
    Gloable:    
        
    Calls:

    Called By:
        
    Others:

    Modify Record:
    
*********************************************************************/
void OnCancle_YMD(UINT8 flag)
{
    struct StpLabelBlk_YMD *p;
    flag=flag;
    p=(struct StpLabelBlk_YMD *)p_S_L_B;
}




/*********************************************************************
    Description:创建一个年月日时分秒设置页,YYMMDDHHMMSS
    
    Input:
        p_HZ_Str:标签
        p_Int:整形变量指针
        x_HZ:汉字标签X坐标
        y_HZ:汉字标签Y坐标
        x_Dat:整数值值X坐标
        y_Dat:整数值Y坐标
        n_Int:显示位数
    Output:
        
    Return:
        
    Gloable:    
        struct  StpLabelBlk_Int:整形数标签页设置数据结构
        p_S_L_B: 无类型指针
        heap:自定义堆内存
    Calls:
        GUI_ClearAll();
        GUI_DispLine_();
        GUI_InvertRect();
        Gui_CharacterStyle_Set12_6();
        BCD2INT_TIME();
        Refresh_YMD();
    Called By:
        
    Others:
        光标位置基于0
    Modify Record:
    
*********************************************************************/
void CreateStpLabel_Int(UINT8 *p_HZ_Str,UINT8 x_HZ,UINT8 y_HZ,unsigned int *p_Int, UINT8 x_Dat,UINT8 y_Dat,UINT8 n_Int)
{
    struct StpLabelBlk_Int *p;
//    Gui_CharacterStyle_Set12_6();
//