鄙人当前的项目使用一块单 {MOD}屏,并移植了emwin,现在需要调用emwin的graph控件做折线图,可是创建控件,并绑定了数据结构,仍不见有折线图显示;恳请哪位有相关经验的大神指点一二;在单 {MOD}屏上使用emwin的graph控件;以下是试探性的代码,按键可以正常显示
pGraph5min = GRAPH_CreateEx(30, 239, 260, 208, WM_HBKWIN, WM_CF_SHOW | WM_CF_CONST_OUTLINE, 0, 0);
// GRAPH_SetUserDraw(GRAPH_Handle hObj, void(* pOwnerDraw)(WM_HWIN, int));
GRAPH_SetBorder(pGraph5min, 30, 10, 20, 15);
// WM_SetHasTrans(pGraph5min);
WIDGET_SetEffect(pGraph5min, &WIDGET_Effect_None);
// GRAPH_SetColor(pGraph5min, GUI_WHITE, GRAPH_CI_BK);
// GRAPH_SetColor(pGraph5min, GUI_WHITE, GRAPH_CI_BORDER);
// GRAPH_SetColor(pGraph5min, GUI_WHITE, GRAPH_CI_FRAME);
// GRAPH_SetColor(pGraph5min, GUI_WHITE, GRAPH_CI_GRID);
//GRAPH_SetGridVis(pGraph5min, 1);
//GRAPH_SetLineStyleH(pGraph5min, GUI_LS_DOT);
//GRAPH_SetLineStyleV(pGraph5min, GUI_LS_DOT);
GRAPH_SetGridDistX(pGraph5min, 25);
GRAPH_SetGridDistY(pGraph5min, 25);
GRAPH_SetGridFixedX(pGraph5min, 1);
pGraph5minDat = GRAPH_DATA_YT_Create(GUI_BLACK, 150, 0, 0);
GRAPH_AttachData(pGraph5min, pGraph5minDat);
GRAPH_DATA_YT_SetOffY(pGraph5minDat, 20);
GRAPH_DATA_YT_SetAlign(pGraph5minDat, GRAPH_ALIGN_LEFT);
GRAPH_DATA_YT_Clear(pGraph5minDat);
int i = 0;
for(; i<150; i++)
{
GRAPH_DATA_YT_AddValue(pGraph5minDat, i);
}
hbutton = BUTTON_CreateEx(300,50,60,40,WM_HBKWIN, WM_CF_SHOW | WM_CF_CONST_OUTLINE, 0, 0);
BUTTON_SetFont(hbutton, GUI_FONT_20_1);
BUTTON_SetText(hbutton, "BTN");
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
单 {MOD}屏移植emwin,需要找到emwin相关LCD驱动。在LCDConf_FlexColor_Template.c中修改相应LCD配置:
例:某型号TFT-lcd驱动:
GUIDRV_FlexColor_SetFunc(pDevice, &PortAPI, GUIDRV_FLEXCOLOR_F66702, GUIDRV_FLEXCOLOR_M16C0B16);
好的,我去看看
自己用emwin基本函数写了一个,凑合用吧
一周热门 更多>