?? time.c
字號:
/* 以下代碼用于顯示時間區(qū)域背景 */int time_bakcolor_Beijing (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "北京時間\n" "宏偉的北京天安門"; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Tokyo (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "日本時間\n" "美麗的日本富士山"; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Newyork (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "紐約時間\n" "紐約的自由女神像"; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Rome (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "羅馬時間\n" ""; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Berlin (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "柏林時間\n" ""; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Paris (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "巴黎時間\n" ""; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_London (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "倫敦時間\n" ""; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Cairo (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "開羅時間\n" ""; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Sydney (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "悉尼時間\n" ""; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}int time_bakcolor_Brazilia (HDC hdc){ RECT rc; const char* szBuff_Beijing_1 = "巴塞羅那時間\n" ""; rc.left = 320; rc.top =150; rc.right = 635; rc.bottom = 210; SetBkColor (hdc, COLOR_yellow); //設(shè)置字體背景顏色 SetTextColor (hdc, PIXEL_darkred); //設(shè)置字體顏色 SetPenColor(hdc, PIXEL_blue); //設(shè)置線條顏色 Rectangle (hdc, rc.left, rc.top, rc.right, rc.bottom); SetBrushColor (hdc, PIXEL_yellow); FillBox(hdc, rc.left, rc.top, rc.right, rc.bottom-150); InflateRect (&rc, -1, -1); SelectFont (hdc, logfontttf2); DrawText (hdc, szBuff_Beijing_1, -1, &rc, DT_NOCLIP | DT_CENTER | DT_WORDBREAK);}/* 以下代碼用于顯示時間 */static char* mk_time_Beijing (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Tokyo (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+3; //判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Newyork (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+4; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Rome (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+5; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Berlin (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+6; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Paris (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+7; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_London (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+8; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Cairo (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+9; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Sydney (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+10; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}static char* mk_time_Brazilia (char* buff){ time_t t; struct tm * tm; time (&t); tm = localtime (&t); tm->tm_hour=tm->tm_hour+20; // 判斷是否大于24 if(tm->tm_hour>24) tm->tm_hour=tm->tm_hour-24; sprintf (buff, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec); return buff;}/*以下代碼用于各地的日期顯示*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -