初级会员
- 积分
- 107
- 金钱
- 107
- 注册时间
- 2015-10-14
- 在线时间
- 2 小时
|
楼主 |
发表于 2015-11-5 07:48:35
|
显示全部楼层
用了一个标志位判断是否需要重绘,定时误差就很小了,代码如下,各位有没有更好的办法?求指点!
static void CallBack(WM_MESSAGE* pMsg)
{
static ubool uFlag = 0;
switch (pMsg->MsgId)
{
case WM_CREATE:
TEXT_CreateEx(0, 58*4+13, 200, 30,pMsg->hWin,WM_CF_SHOW,0,GUI_ID_TEXT0,"00:00:00");
TEXT_SetFont(WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0),&GUI_FontHZ32);
TEXT_SetTextColor(WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0),GUI_WHITE);
TEXT_SetTextAlign(WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0),TEXT_CF_HCENTER|TEXT_CF_VCENTER );
TEXT_SetBkColor(WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0),GUI_BLACK);
break;
case WM_PAINT:
if(1==uFlag)
{
uFlag =0;
}
else
{
PaintWin(pMsg);
}
break;
case WM_TIMER:
WM_RestartTimer(pMsg->Data.v, 1000);
uFlag =1;
TEXT_SetText(WM_GetDialogItem(pMsg->hWin, GUI_ID_TEXT0),“hello”);
break;
default:
WM_DefaultProc(pMsg);
break;
}
} |
|