|

楼主 |
发表于 2019-12-24 11:00:05
|
显示全部楼层
case WM_PAINT:
if((0 == (ucLastSel%3))&&(1 == (ucLastSel - ucCurrSel)))//换行
{
ShowBMP(xHmiIconInfo[ucLastSel + 1].pcPath,xHmiIconInfo[ucLastSel + 1].x0,xHmiIconInfo[ucLastSel + 1].y0);
ShowBMP(xHmiIconInfo[ucLastSel + 2].pcPath,xHmiIconInfo[ucLastSel + 2].x0,xHmiIconInfo[ucLastSel + 2].y0);
ShowBMP(xHmiIconInfo[ucCurrSel - 1].pcPath,xHmiIconInfo[ucCurrSel - 1].x0,xHmiIconInfo[ucCurrSel - 1].y0);
ShowBMP(xHmiIconInfo[ucCurrSel - 2].pcPath,xHmiIconInfo[ucCurrSel - 2].x0,xHmiIconInfo[ucCurrSel - 2].y0);
}else if((0 == (ucCurrSel%3))&&(1 == (ucCurrSel - ucLastSel))){
ShowBMP(xHmiIconInfo[ucCurrSel + 1].pcPath,xHmiIconInfo[ucCurrSel + 1].x0,xHmiIconInfo[ucCurrSel + 1].y0);
ShowBMP(xHmiIconInfo[ucCurrSel + 2].pcPath,xHmiIconInfo[ucCurrSel + 2].x0,xHmiIconInfo[ucCurrSel + 2].y0);
ShowBMP(xHmiIconInfo[ucLastSel - 1].pcPath,xHmiIconInfo[ucLastSel - 1].x0,xHmiIconInfo[ucLastSel - 1].y0);
ShowBMP(xHmiIconInfo[ucLastSel - 2].pcPath,xHmiIconInfo[ucLastSel - 2].x0,xHmiIconInfo[ucLastSel - 2].y0);
}else if(0xff == ucSel){//由参数界面进入或初次进入
for(i = 0; i<ICON_MAX_SEL + 1; i++)
{
ShowBMP(xHmiIconInfo[ICON_MIN_SEL + i].pcPath,xHmiIconInfo[ICON_MIN_SEL + i].x0,xHmiIconInfo[ICON_MIN_SEL + i].y0);
}
}
ucLastSel = ucCurrSel;
break;
static void _IconCallback(WM_MESSAGE * pMsg)//只需判断用哪个字体就行
{
WM_HWIN hWin;
static unsigned char ucLastSel = 0;
unsigned char i = 0;
unsigned char ucCurrSel = 0;
hWin = pMsg->hWin;
switch(pMsg->MsgId)
{
case WM_PAINT:
GUI_SetTextMode(GUI_TM_TRANS);
if(CHINESE == INTEFFACE_GET_LANGUAGE()){
GUI_SetDefaultFont(ulHmiIconFontChinese[ICON_DEFAULT_FONT]);
}else if(ENGLISH == INTEFFACE_GET_LANGUAGE()){
GUI_SetDefaultFont(ulHmiIconFontEnglish[ICON_DEFAULT_FONT]);
}
GUI_SetColor(GUI_RED);
for(i = 0; i<ICON_MAX_SEL + 1; i++)
{
if(CHINESE == INTEFFACE_GET_LANGUAGE()){
GUI_DispStringAt(xHmiIconInfo[ICON_MIN_SEL + i].pcChinese, xHmiIconInfo[ICON_MIN_SEL + i].x0 , xHmiIconInfo[ICON_MIN_SEL + i].y0 + 48);
}else if(ENGLISH == INTEFFACE_GET_LANGUAGE()){
GUI_DispStringAt(xHmiIconInfo[ICON_MIN_SEL + i].pcEnglish, xHmiIconInfo[ICON_MIN_SEL + i].x0 , xHmiIconInfo[ICON_MIN_SEL + i].y0 + 48);
}
}
ucCurrSel = ICONVIEW_GetSel(hWin);
if((ucCurrSel>=ICON_MIN_SEL) && (ucCurrSel<=ICON_MAX_SEL)){
GUI_SetColor(GUI_YELLOW);
GUI_FillRect(xHmiIconInfo[ucCurrSel].x0,xHmiIconInfo[ucCurrSel].y0,xHmiIconInfo[ucCurrSel].x1,xHmiIconInfo[ucCurrSel].y1);
ShowBMP(xHmiIconInfo[ucLastSel].pcPath,xHmiIconInfo[ucLastSel].x0,xHmiIconInfo[ucLastSel].y0);
ShowBMP(xHmiIconInfo[ucCurrSel].pcPath,xHmiIconInfo[ucCurrSel].x0,xHmiIconInfo[ucCurrSel].y0);
ucLastSel = ucCurrSel;//
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetColor(GUI_BLUE);
if(CHINESE == INTEFFACE_GET_LANGUAGE()){
GUI_DispStringAt(xHmiIconInfo[ucCurrSel].pcChinese, xHmiIconInfo[ucCurrSel].x0 , xHmiIconInfo[ucCurrSel].y0 + 48);
}else if(ENGLISH == INTEFFACE_GET_LANGUAGE()){
GUI_DispStringAt(xHmiIconInfo[ucCurrSel].pcEnglish, xHmiIconInfo[ucCurrSel].x0 , xHmiIconInfo[ucCurrSel].y0 + 48);
}
}
break;
default:
ICONVIEW_Callback(pMsg);
break;
}
}
在WINDOW的回调函数内的WM_PAINT使用bmp显示全部图标 在ICONVIEW回调函数内使用WM_PAINT重绘需要改变背景的图标 但是现在背景色会被覆盖,大佬指点下
|
|