|
- //日历填写函数
- void _FillCalendar( CLD_DAY *pDay, u8 year, u8 month, u8 day)
- {
- const u8 cstmonth[][4] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEQ", "OCT", "NOV", "DEC" };
- const u8 monthDay[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
- u8 tmpDis[] = { " < JAN 2015 > " };
- u8 tmpWek;
- u8 i;
- // GUI_SetFont(&GUI_Font32_ASCII);
- //GUI_SetColor(GUI_BLACK); //设置蓝色
- memcpy(&tmpDis[9], cstmonth[month], 3);
- tmpDis[15] = (year >> 4) + '0';
- tmpDis[16] = (year & 0x0F) + '0';
- //GUI_DispStringHCenterAt(tmpDis, 160, 5);//显示月份
- LCD_ShowString(58,15,200,16,16,tmpDis); //显示月份
- tmpWek = _DayToWeek(year, month, 0x01); //获取星期
- for (i = 0; i < tmpWek; i++) //存储上月的
- {
- if (month == 0x01)
- {
- (*pDay).Date = monthDay[12 - 1] - tmpWek + i + 1;
- }
- else
- {
- (*pDay).Date = monthDay[month - 2] - tmpWek + i+1;
- }
- //pDay.Color = GUI_GRAY;
- (*pDay).Color= GRAY ;
- }
-
- for ( i = 0; i < monthDay[month-1]; i++)
- {
- pDay[i + tmpWek].Date = i+1; //存储本月的
- //pDay[i + tmpWek].Color = (day == i + 1) ? GUI_GREEN : GUI_BLACK;
- pDay[i + tmpWek].Color = (day == i + 1) ? GREEN : BLACK;
- }
- for ( i = 0; i < 42 - tmpWek - monthDay[month-1]; i++)
- {
- if (month == 0x12)
- {
- pDay[i + tmpWek + monthDay[1-1]].Date = i + 1;
- }
- else
- {
- pDay[i + tmpWek + monthDay[month - 1]].Date = i + 1; //存储下月的
- }
- pDay[i + tmpWek + monthDay[month-1]].Color = GRAY;
- }
- for ( i = 0; i < 42; i++)
- {
- //GUI_SetFont(&GUI_Font24_ASCII);
- // GUI_SetColor(pDay.Color);
- // (*pDay).Color=GRAY;
- POINT_COLOR=BLUE;
- // GUI_SetTextAlign(GUI_TA_HCENTER | GUI_TA_VCENTER);
- // GUI_DispDecAt(pDay.Date, pDay.X, pDay.Y, ((pDay.Date > 10) ? 2 : 1));
- //LCD_ShowChar((*pDay).X, (*pDay).Y,(*pDay).Date,12,1);
- // LCD_ShowChar(10,10,(*pDay).Date,12,1);
- sprintf((char*)tbuf,"%02d",(*pDay).Date);
- // LCD_ShowString(5,5,210,16,16,tbuf);
- LCD_ShowString((*pDay).X, (*pDay).Y,200,12,12,tbuf);
- }
- }
- //日历显示
- void DisCalendar(u8 year, u8 month, u8 day)
- {
- CLD_DAY tmpDay[42];
- _DrawCalendar(tmpDay);
- _FillCalendar(tmpDay, year, month, day);
- }
复制代码
为什么只显示一个数字呢,楼主的开发环境和我的不一样啊,要怎么修改才能全部显示呢?!我没有用GUI用的是普通的LCD函数。。 |
|