新手入门
- 积分
- 16
- 金钱
- 16
- 注册时间
- 2022-11-21
- 在线时间
- 3 小时
|
我用的是emWin5.44的库, 在PC上做的界面显示挺好,现在移植到探索者407的板子上。 我按下复位键,界面有时候能显示,有时候不显示。 特别是TEXT设置了大字体,后面的文字,就不显示了,同一个TEXT控件后面的显示不了,其他控件都不在一行的,也显示不了。请各位同学帮我看看, 现在已经晕头转向,不知所措了
* Compiled Nov 10 2017, 08:53:57 *
* (c) 2017 Segger Microcontroller GmbH & Co. KG *
* *
**********************************************************************
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
*/
#include "GUI.h"
#include "DIALOG.h"
//Added
#include "Common.h"
//Added
//#pragma execution_character_set("utf-8")
// USER START (Optionally insert additional includes)
// USER END
//Added
//要使用的外部定义的字体
extern GUI_CONST_STORAGE GUI_FONT GUI_FontSprayWords24;
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define ID_WINDOW_0 (GUI_ID_USER + 0x00)
#define ID_TEXT_COMPANY (GUI_ID_USER + 0x01)
#define ID_TEXT_BRAND (GUI_ID_USER + 0x02)
#define ID_TEXT_HELLO1 (GUI_ID_USER + 0x03)
#define ID_TEXT_HELLO2 (GUI_ID_USER + 0x04)
#define ID_TEXT_MODEL_NAME (GUI_ID_USER + 0x05)
#define ID_TEXT_MODEL_VALUE (GUI_ID_USER + 0x06)
// USER START (Optionally insert additional defines)
// USER END
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
// USER START (Optionally insert additional static data)
// USER END
/*********************************************************************
*
* _aDialogCreate
*/
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 480, 800, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "VlcNo", ID_TEXT_COMPANY, 59, 114, 76, 32, 0, 0x00, 128 },
{ TEXT_CreateIndirect, "Brand", ID_TEXT_BRAND, 142, 116, 76, 32, 0, 0x00, 128 },
{ TEXT_CreateIndirect, "Welcome to Use", ID_TEXT_HELLO1, 150, 322, 197, 32, 0, 0x00, 128 },
{ TEXT_CreateIndirect, "Portable Hand-held Inkject Printer", ID_TEXT_HELLO2, 0, 410, 480, 32, 0, 0x00, 128},
{ TEXT_CreateIndirect, "Model:", ID_TEXT_MODEL_NAME, 160, 553, 101, 32, 0, 0x00, 128 },
{ TEXT_CreateIndirect, "HJ-32120", ID_TEXT_MODEL_VALUE, 250, 551, 96, 32, 0, 0x00, 128 },
// USER START (Optionally insert additional widgets)
// USER END
};
static MULT_LANGS multLangsEnglish[]={
{ID_WINDOW_0,""},
{ID_TEXT_COMPANY,"Vlcno"},
{ID_TEXT_BRAND,"Brand"},
{ID_TEXT_HELLO1,"Welcome to Use"},
{ID_TEXT_HELLO2,"Portable Hand-held Inkject Printer"},
{ID_TEXT_MODEL_NAME,"Model:"},
{ID_TEXT_MODEL_VALUE,"HJ-32120"}
};
static MULT_LANGS multLangsChinese[]={
{ID_WINDOW_0,""},
{ID_TEXT_COMPANY,"Vlcno"},
{ID_TEXT_BRAND,"品牌"},
{ID_TEXT_HELLO1,"欢迎使用"},
{ID_TEXT_HELLO2,"便携式喷码打印机"},
{ID_TEXT_MODEL_NAME,""},
{ID_TEXT_MODEL_VALUE,"HJ-32120"}
};
static MULT_LANGS *multLangs;
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
// USER START (Optionally insert additional static code)
// USER END
/*********************************************************************
*
* _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
int i;
// USER START (Optionally insert additional variables)
// USER END
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
//
// Initialization of 'Window'
//
hItem = pMsg->hWin;
//WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x00FF8000));
WINDOW_SetBkColor(hItem, DESKTOP_BK_COLOR);
//
// Initialization of 'Text'
//
for(i=1;i<sizeof(_aDialogCreate)/sizeof(_aDialogCreate[0]);i++)
{
hItem = WM_GetDialogItem(pMsg->hWin,_aDialogCreate.Id);
//TEXT_SetText(hItem,(const char *)multLangs.text);
//TEXT_SetText(hItem, "Hello,world");
//TEXT_SetFont(hItem,&GUI_FontSprayWords16);
TEXT_SetFont(hItem,&GUI_Font16_ASCII);
if(_aDialogCreate.Id==ID_TEXT_COMPANY)
TEXT_SetTextColor(hItem,GUI_RED);
else
TEXT_SetTextColor(hItem,GUI_WHITE);
//TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
}
break;
// USER START (Optionally insert additional message handling)
// USER END
default:
WM_DefaultProc(pMsg);
break;
}
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* CreateWindow
*/
WM_HWIN CreateStartWin(void);
WM_HWIN CreateStartWin(void) {
WM_HWIN hWin;
//根据语言配置,选择采用什么语言
switch(nLanguage)
{
case LANG_EN:
multLangs=multLangsEnglish;
break;
case LANG_CH:
multLangs=multLangsChinese;
break;
default:
break;
}
hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
return hWin;
}
// USER START (Optionally insert additional public code)
// USER END
|
|