通过结构体
typedef struct
{
// U16 ImgID;
MYTIME CalTime;
clndr_lnuar_date_info_struct LunarInfo;
// S8 TitleString[CLNDR_TITLE_LEN];
S8 DayBuf[CLNDR_DAY_LEN];
S8 MonBuf[CLNDR_MON_LEN];
S8 YearBuf[CLNDR_YEAR_LEN];
U8 TaskDayList[CLNDR_MAX_DAYS+1];
U8 LunarState;
U8 DayOnFirst;
U8 NumDaysInMonth;
}clndr_context_struct;
中的
LunarInfo来实现功能
主要实现代码如下:
void idle_lunar_display(void) { U8 tmp_str[100] = {0x00}; MYTIME currentTime; S32 w,h,startY=79; g_clndr_cntx=NULL; if(!IsChineseSet()) { return; } g_clndr_cntx = OslMalloc(sizeof(clndr_context_struct)); GetDateTime(¤tTime); memset(&g_clndr_cntx->CalTime, 0, sizeof(MYTIME)); g_clndr_cntx->LunarInfo.SolarMonth = currentTime.nDay; g_clndr_cntx->LunarInfo.SolarYear = currentTime.nMonth; g_clndr_cntx->LunarInfo.SolarDay = currentTime.nYear; memset(g_clndr_cntx->LunarInfo.TitleInfo1, 0, CLNDR_TITLE_LEN); memset(g_clndr_cntx->LunarInfo.TitleInfo2, 0, CLNDR_TITLE_LEN); memset(g_clndr_cntx->LunarInfo.MessageLine1, 0, CLNDR_HINT_LEN); memset(g_clndr_cntx->LunarInfo.MessageLine2, 0, CLNDR_HINT_LEN); memset(g_clndr_cntx->LunarInfo.MessageLine3, 0, CLNDR_HINT_LEN); ClndrComputeLunarInfo(&g_clndr_cntx->LunarInfo); gui_measure_string(g_clndr_cntx->LunarInfo.TitleInfo1, &w, &h); gdi_draw_solid_rect((UI_device_width-w)/2, startY, (UI_device_width-w)/2+w, startY+h, GDI_COLOR_WHITE); gui_set_text_color(gui_color(0,0,0)); gui_move_text_cursor((UI_device_width-w)/2, startY); gui_set_font(&MMI_large_font); sprintf((char *)tmp_str, "%10s",g_clndr_cntx->LunarInfo.TitleInfo1); gui_print_text((UI_string_type) tmp_str ); }