以前使用emWin创建多个image控件时就需要定义多个FIL类型的变量来保留图片句柄让wmWin自己刷新,比如:
FIL bmp[5];
SET_hImage[0]= IMAGE_CreateEx(0, 20,240,30,WM_HBKWIN,WM_CF_SHOW,IMAGE_CF_TILE,ID_SET_TOUCH);
SET_hImage[1]= IMAGE_CreateEx(0, 50,240,30,WM_HBKWIN,WM_CF_SHOW,IMAGE_CF_TILE,ID_SET_TIME);
SET_hImage[2]= IMAGE_CreateEx(0, 80,240,30,WM_HBKWIN,WM_CF_SHOW,IMAGE_CF_TILE,ID_SET_BKIMAGE);
SET_hImage[3]= IMAGE_CreateEx(0,110,240,30,WM_HBKWIN,WM_CF_SHOW,IMAGE_CF_TILE,ID_SET_HELP);
SET_hImage[4]= IMAGE_CreateEx(0,140,240,30,WM_HBKWIN,WM_CF_SHOW,IMAGE_CF_TILE,ID_SET_EXIT);
f_open(&bmp[0],"picture/set/touch/touch.bmp",FA_READ);
IMAGE_SetBMPEx(SET_hImage[0],_Get_BackImage,(void *)&bmp[0]);
f_open(&bmp[1],"picture/set/time/time.bmp",FA_READ);
IMAGE_SetBMPEx(SET_hImage[1],_Get_BackImage,(void *)&bmp[1]);
f_open(&bmp[2],"picture/set/bkimage/bkimage.bmp",FA_READ);
IMAGE_SetBMPEx(SET_hImage[2],_Get_BackImage,(void *)&bmp[2]);
f_open(&bmp[3],"picture/set/help/help.bmp",FA_READ);
IMAGE_SetBMPEx(SET_hImage[3],_Get_BackImage,(void *)&bmp[3]);
f_open(&bmp[4],"picture/set/exit/exit.bmp",FA_READ);
IMAGE_SetBMPEx(SET_hImage[4],_Get_BackImage,(void *)&bmp[4]);
这样的缺点就是每个FIL都会有一个自己的数据缓冲区,我的是512字节这样比较占用内存,然后我修改了fatfs配置
#define _FS_TINY 1 //使用共用的数据缓冲区
这样修改后在编译发现内存占用小了很多,但是image控件不能显示了不过当我在适当的位置去触摸IMAGE控件时发现控件是创建成功了不过不显示!是不是fatfs还有哪里也要相应的配置一下?
不设置TINY很耗内存,
一周热门 更多>