这个是在原子哥的EMWIN实验34 汉字显示(FLASH外置字库)的基础上弄的,不知道是不是我放图片的方式有错
#include "DIALOG.h"
#include "EmWinHZFont.h"
#define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
#define ID_IMAGE_0 (GUI_ID_USER + 0x01)
#define ID_TEXT_0 (GUI_ID_USER + 0x02)
#define ID_TEXT_1 (GUI_ID_USER + 0x03)
#define ID_TEXT_2 (GUI_ID_USER + 0x04)
#define ID_TEXT_3 (GUI_ID_USER + 0x05)
#define ID_TEXT_4 (GUI_ID_USER + 0x06)
#define ID_TEXT_5 (GUI_ID_USER + 0x07)
#define ID_EDIT_0 (GUI_ID_USER + 0x08)
#define ID_EDIT_1 (GUI_ID_USER + 0x09)
#define ID_EDIT_2 (GUI_ID_USER + 0x0A)
#define ID_EDIT_3 (GUI_ID_USER + 0x0B)
#define ID_EDIT_4 (GUI_ID_USER + 0x0C)
#define ID_TEXT_6 (GUI_ID_USER + 0x0D)
#define ID_TEXT_7 (GUI_ID_USER + 0x0E)
#define ID_TEXT_8 (GUI_ID_USER + 0x0F)
#define ID_TEXT_9 (GUI_ID_USER + 0x10)
#define ID_TEXT_10 (GUI_ID_USER + 0x11)
#define ID_EDIT_5 (GUI_ID_USER + 0x12)
#define ID_TEXT_11 (GUI_ID_USER + 0x13)
#define ID_BUTTON_0 (GUI_ID_USER + 0x14)
#define ID_BUTTON_1 (GUI_ID_USER + 0x15)
#define ID_BUTTON_2 (GUI_ID_USER + 0x16)
#define ID_BUTTON_3 (GUI_ID_USER + 0x17)
#define ID_IMAGE_0_IMAGE_0 0x00
static const U8 _acImage_0[51081] = {
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = { { FRAMEWIN_CreateIndirect, "FRAMEWIN", ID_FRAMEWIN_0, 0, 0, 1024, 600, 0, 0x0, 0 },
{ IMAGE_CreateIndirect, "IMAGE", ID_IMAGE_0, -3, 0, 1024, 600, 0, 0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_0, 848, 11, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_1, 700, 71, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_2, 700, 124, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_3, 700, 174, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_4, 700, 224, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_5, 700, 274, 100, 40, 0, 0x0, 0 },
{ EDIT_CreateIndirect, "EDIT", ID_EDIT_0, 809, 71, 100, 40, 0, 0x64, 0 },
{ EDIT_CreateIndirect, "EDIT", ID_EDIT_1, 809, 124, 100, 40, 0, 0x64, 0 },
{ EDIT_CreateIndirect, "EDIT", ID_EDIT_2, 809, 174, 100, 40, 0, 0x64, 0 },
{ EDIT_CreateIndirect, "EDIT", ID_EDIT_3, 809, 224, 100, 40, 0, 0x64, 0 },
{ EDIT_CreateIndirect, "EDIT", ID_EDIT_4, 809, 274, 100, 40, 0, 0x64, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_6, 920, 124, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_7, 920, 174, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_8, 920, 224, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_9, 920, 274, 100, 40, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_10, 848, 354, 100, 40, 0, 0x0, 0 },
{ EDIT_CreateIndirect, "EDIT", ID_EDIT_5, 845, 409, 80, 40, 0, 0x64, 0 },
{ TEXT_CreateIndirect, "TEXT", ID_TEXT_11, 848, 450, 100, 40, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "BUTTON", ID_BUTTON_0, 744, 495, 100, 40, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "BUTTON", ID_BUTTON_1, 911, 495, 100, 40, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "BUTTON", ID_BUTTON_2, 744, 550, 100, 40, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "BUTTON", ID_BUTTON_3, 911, 550, 100, 40, 0, 0x0, 0 },
// USER START (Optionally insert additional widgets)
// USER END
};
static const void * _GetImageById(U32 Id, U32 * pSize) {
switch (Id) {
case ID_IMAGE_0_IMAGE_0:
*pSize = sizeof(_acImage_0);
return (const void *)_acImage_0;
}
return NULL;
}
static void _cbDialog(WM_MESSAGE * pMsg) {
const void * pData;
WM_HWIN hItem;
U32 FileSize;
int NCode;
int Id;
// USER START (Optionally insert additional variables)
// USER END
switch (pMsg->MsgId) {
case WM_INIT_DIALOG:
//
// Initialization of 'Framewin'
//
hItem = pMsg->hWin;
FRAMEWIN_SetTitleHeight(hItem, 1);
//
// Initialization of 'Image'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);
IMAGE_SetJPEG(hItem, pData, FileSize);
//
// Initialization of 'Text'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
|