📄 settimearea.c.bak
字号:
SetRect(&rect, 160,200,190,219); // 创建改变大向下按钮
pButtonCtrl2=CreateButton(ID_MainButtonCtrl,&rect,FONTSIZE_MIDDLE,CTRL_STYLE_3DUPFRAME,A,NULL);
DrawButton(pButtonCtrl2);
SetRect(&rect, 120,200,139,219); // 创建改变小向上按钮
pButtonCtrl3=CreateButton(ID_MainButtonCtrl,&rect,FONTSIZE_MIDDLE,CTRL_STYLE_3DUPFRAME,E,NULL);
DrawButton(pButtonCtrl3);
SetRect(&rect, 139,200,159,219); // 创建改变小向下按钮
pButtonCtrl4=CreateButton(ID_MainButtonCtrl,&rect,FONTSIZE_MIDDLE,CTRL_STYLE_3DUPFRAME,F,NULL);
DrawButton(pButtonCtrl4);
CheckTimeStatus=STStatus_SetSelect;
}
void CreateTimeZoneArea(U8 IsShow)
{
static char TimeKeyTable[]={'1','2','3',0,'4','5','6',0,'7','8','9',0,':','0','\b',0};
U16 strtime[11]={0,};
structRECT rect;
SetRect(&rect, 200,180,275,199);//创建时间文本框
pTimeZoneTextCtrl100=CreateTextCtrl(ID_TimeZone_TextCtrl, &rect, FONTSIZE_MIDDLE, CTRL_STYLE_FRAME,TimeKeyTable,NULL);
Rtc_Format("%H",strtime);
SetTextCtrlText(pTimeZoneTextCtrl100, strtime,IsShow);
SetRect(&rect, 280,180,315,200); // 确定按钮
pButtonCtrl5=CreateButton(ID_MainButtonCtrl,&rect,FONTSIZE_MIDDLE,CTRL_STYLE_3DUPFRAME,B,NULL);
DrawButton(pButtonCtrl5);
SetRect(&rect, 280,200,315,219); // 取消按钮
pButtonCtrl6=CreateButton(ID_MainButtonCtrl,&rect,FONTSIZE_MIDDLE,CTRL_STYLE_3DUPFRAME,C,NULL);
DrawButton(pButtonCtrl6);
SetRect(&rect, 95,180,199,199); //创建日期文本框
pTimeZoneTextCtrl101=CreateTextCtrl(ID_TimeZone_TextCtrl3, &rect, FONTSIZE_MIDDLE, CTRL_STYLE_FRAME,NULL,NULL);
SetTextCtrlText(pTimeZoneTextCtrl101, Z,FALSE);
TimeZoneStatus=STStatus_SetSelect;
}
void DestorySetTimeArea()
{
PDC pdc;
pdc=CreateDC();
DestoryTextCtrl(pDateTextCtrl);
DestoryTextCtrl(pTimeTextCtrl);
DestoryButton(pButtonCtrl5);
DestoryButton(pButtonCtrl6);
FillRect(pdc, 90, 180, 319, 220, GRAPH_MODE_NORMAL, COLOR_WHITE);
ReDrawOSCtrl();
DestoryDC(pdc);
}
void DestoryCheckTimeArea()
{
PDC pdc;
pdc=CreateDC();
DestoryTextCtrl(pYearTextCtrl);
DestoryTextCtrl(pMonthTextCtrl);
DestoryTextCtrl(pDayTextCtrl);
DestoryButton(pButtonCtrl1);
DestoryButton(pButtonCtrl2);
DestoryButton(pButtonCtrl3);
DestoryButton(pButtonCtrl4);
DestoryButton(pButtonCtrl5);
DestoryButton(pButtonCtrl6);
FillRect(pdc, 90, 180, 319, 220, GRAPH_MODE_NORMAL, COLOR_WHITE);
SetTextCtrlEdit(pTimeZoneTextCtrl52, FALSE);
SetTextCtrlEdit(pTimeZoneTextCtrl54, FALSE);
SetTextCtrlEdit(pTimeZoneTextCtrl56, FALSE);
SetTextCtrlEdit(pTimeZoneTextCtrl59, FALSE);
SetTextCtrlEdit(pTimeZoneTextCtrl61, FALSE);
SetTextCtrlEdit(pTimeZoneTextCtrl62, FALSE);
pTimeZoneTextCtrl52->text[0]=0;
pTimeZoneTextCtrl54->text[0]=0;
pTimeZoneTextCtrl56->text[0]=0;
pTimeZoneTextCtrl59->text[0]=0;
pTimeZoneTextCtrl61->text[0]=0;
pTimeZoneTextCtrl62->text[0]=0;
ReDrawOSCtrl();
DestoryDC(pdc);
}
extern PListCtrl pMainListCtrl;
void DestoryTimeZoneArea()
{
PDC pdc;
pdc=CreateDC();
DestoryTextCtrl(pTimeZoneTextCtrl100);
DestoryTextCtrl(pTimeZoneTextCtrl101);
DestoryButton(pButtonCtrl5);
DestoryButton(pButtonCtrl6);
FillRect(pdc, 90, 180, 319, 220, GRAPH_MODE_NORMAL, COLOR_WHITE);
ReLoadListCtrl(pMainListCtrl,MainFn,MAIN_FUNCTION_NUM);
ReDrawOSCtrl();
DestoryDC(pdc);
}
void SetTimeSetFocus()
{
SetWndCtrlFocus(NULL, ID_SetDate_TextCtrl);
}
void CheckTimeSetFocus()
{
SetWndCtrlFocus(NULL, ID_SetYear_TextCtrl);
}
void TimeZoneSetFocus()
{
SetWndCtrlFocus(NULL, ID_TimeZone_TextCtrl);
}
void SetTimeUp()
{
switch(SetTimeStatus){
case STStatus_SetSelect:
if(GetWndCtrlFocus(NULL)==ID_SetTime_TextCtrl){
SetWndCtrlFocus(NULL, ID_SetDate_TextCtrl);
DrawTextCtrl(pTimeTextCtrl);
DrawTextCtrl(pDateTextCtrl);
}
break;
}
}
void SetTimeDown()
{
switch(SetTimeStatus){
case STStatus_SetSelect:
if(GetWndCtrlFocus(NULL)==ID_SetDate_TextCtrl){
SetWndCtrlFocus(NULL, ID_SetTime_TextCtrl);
DrawTextCtrl(pTimeTextCtrl);
DrawTextCtrl(pDateTextCtrl);
}
break;
}
}
void CheckTimeDown()
{
switch(CheckTimeStatus){
case STStatus_SetSelect:
if(GetWndCtrlFocus(NULL)==ID_SetYear_TextCtrl){
SetWndCtrlFocus(NULL, ID_SetMonth_TextCtrl);
DrawTextCtrl(pYearTextCtrl);
DrawTextCtrl(pMonthTextCtrl);
DrawTextCtrl(pDayTextCtrl);
DrawTextCtrl(pHourTextCtrl);
DrawTextCtrl(pMinuteTextCtrl);
DrawTextCtrl(pSecondTextCtrl);
}
else if(GetWndCtrlFocus(NULL)==ID_SetMonth_TextCtrl){
SetWndCtrlFocus(NULL, ID_SetDay_TextCtrl);
DrawTextCtrl(pYearTextCtrl);
DrawTextCtrl(pMonthTextCtrl);
DrawTextCtrl(pDayTextCtrl);
DrawTextCtrl(pHourTextCtrl);
DrawTextCtrl(pMinuteTextCtrl);
DrawTextCtrl(pSecondTextCtrl);
}
break;
}
}
void CheckTimeUp()
{
switch(CheckTimeStatus){
case STStatus_SetSelect:
if(GetWndCtrlFocus(NULL)==ID_SetMonth_TextCtrl){
SetWndCtrlFocus(NULL, ID_SetYear_TextCtrl);
DrawTextCtrl(pYearTextCtrl);
DrawTextCtrl(pMonthTextCtrl);
DrawTextCtrl(pDayTextCtrl);
DrawTextCtrl(pHourTextCtrl);
DrawTextCtrl(pMinuteTextCtrl);
DrawTextCtrl(pSecondTextCtrl);
}
else if(GetWndCtrlFocus(NULL)==ID_SetDay_TextCtrl){
SetWndCtrlFocus(NULL, ID_SetMonth_TextCtrl);
DrawTextCtrl(pYearTextCtrl);
DrawTextCtrl(pMonthTextCtrl);
DrawTextCtrl(pDayTextCtrl);
DrawTextCtrl(pHourTextCtrl);
DrawTextCtrl(pMinuteTextCtrl);
DrawTextCtrl(pSecondTextCtrl);
}
break;
}
}
void SetFormatTime() //设定格式化以后的时间
{
U16* ptext=pTimeTextCtrl->text;
U32 tmp[3],i;
structClock clock;
int h;
for(i=0;i<3;i++){
tmp[i]=0;
while(*ptext && *ptext !=':'){
tmp[i]<<=4;
tmp[i]|=(*ptext)-'0';
ptext++;
}
ptext++;
}
clock.hour=tmp[0];
clock.minute=tmp[1];
clock.second=tmp[2];
Set_Rtc_Clock(&clock);
SetTextCtrlEdit(pTimeTextCtrl, FALSE);
DrawTextCtrl(pTimeTextCtrl);
SetTimeStatus=STStatus_SetSelect;
}
void SetFormatDate() //设定格式化以后的日期
{
U16* ptext=pDateTextCtrl->text;
U32 tmp[3],i;
structDate date;
for(i=0;i<3;i++){
tmp[i]=0;
while(*ptext && *ptext !='.'){
tmp[i]<<=4;
tmp[i]|=(*ptext)-'0';
ptext++;
}
ptext++;
}
date.year=tmp[0]&0xff;
date.month=tmp[1];
date.day=tmp[2];
Set_Rtc_Date(&date);
SetTextCtrlEdit(pDateTextCtrl, FALSE);
DrawTextCtrl(pDateTextCtrl);
SetTimeStatus=STStatus_SetSelect;
}
void SetTimeOK()
{
switch(SetTimeStatus){
case STStatus_SetSelect:
if(GetWndCtrlFocus(NULL)==ID_SetDate_TextCtrl){
SetTimeStatus=STStatus_SetDate;
pDateTextCtrl->text[0]=0;
SetTextCtrlEdit(pDateTextCtrl, TRUE);
DrawTextCtrl(pDateTextCtrl);
}
else if(GetWndCtrlFocus(NULL)==ID_SetTime_TextCtrl){
SetTimeStatus=STStatus_SetTime;
pTimeTextCtrl->text[0]=0;
SetTextCtrlEdit(pTimeTextCtrl, TRUE);
DrawTextCtrl(pTimeTextCtrl);
}
break;
case STStatus_SetTime:
SetFormatTime(); //设定格式化以后的时间
break;
case STStatus_SetDate:
SetFormatDate(); //设定格式化以后的日期
break;
}
}
void CheckTimeOK()
{
switch(CheckTimeStatus){
case STStatus_SetSelect:
if(GetWndCtrlFocus(NULL)==ID_SetYear_TextCtrl){
CheckTimeStatus=STStatus_SetYear;
pYearTextCtrl->text[0]=0;
SetTextCtrlEdit(pYearTextCtrl, TRUE);
DrawTextCtrl(pYearTextCtrl);
}
else if(GetWndCtrlFocus(NULL)==ID_SetMonth_TextCtrl){
CheckTimeStatus=STStatus_SetMonth;
pMonthTextCtrl->text[0]=0;
SetTextCtrlEdit(pMonthTextCtrl, TRUE);
DrawTextCtrl(pMonthTextCtrl);
}
else if(GetWndCtrlFocus(NULL)==ID_SetDay_TextCtrl){
CheckTimeStatus=STStatus_SetDay;
pDayTextCtrl->text[0]=0;
SetTextCtrlEdit(pDayTextCtrl, TRUE);
DrawTextCtrl(pDayTextCtrl);
}
break;
case STStatus_SetYear:
SetTextCtrlEdit(pYearTextCtrl, FALSE);
DrawTextCtrl(pYearTextCtrl);
CheckTimeStatus=STStatus_SetSelect;
break;
case STStatus_SetMonth:
SetTextCtrlEdit(pMonthTextCtrl, FALSE);
DrawTextCtrl(pMonthTextCtrl);
CheckTimeStatus=STStatus_SetSelect;
break;
case STStatus_SetDay:
SetTextCtrlEdit(pDayTextCtrl, FALSE);
DrawTextCtrl(pDayTextCtrl);
exchange();
/*mainstatus=MAIN_CHECKTIME;*/
CheckTimeStatus=STStatus_SetSelect;
break;
}
}
void TimeZoneOK()
{
switch(TimeZoneStatus){
case STStatus_SetSelect:
if(GetWndCtrlFocus(NULL)==ID_TimeZone_TextCtrl){
TimeZoneStatus=STStatus_Setok;
pTimeZoneTextCtrl100->text[0]=0;
SetTextCtrlEdit(pTimeZoneTextCtrl100, TRUE);
DrawTextCtrl(pTimeZoneTextCtrl100);
}
break;
case STStatus_Setok:
SetTextCtrlEdit(pTimeZoneTextCtrl100, FALSE);
DrawTextCtrl(pTimeZoneTextCtrl100);
/*TimeZoneStatus=STStatus_SetSelect;*/
mainstatus=TIMEZONE_ZHONGTUDAO;
break;
}
}
void SetTimeCancel()
{
U16 strtime[11];
switch(SetTimeStatus){
case STStatus_SetDate:
SetTextCtrlEdit(pDateTextCtrl, FALSE);
Rtc_Format("20%Y.%M.%D",strtime);
SetTextCtrlText(pDateTextCtrl, strtime,TRUE);
SetTimeStatus=STStatus_SetSelect;
break;
case STStatus_SetTime:
SetTextCtrlEdit(pTimeTextCtrl, FALSE);
Rtc_Format("%H:%I:%S",strtime);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -