硬汉嵌入式论坛

 找回密码
 立即注册
查看: 765|回复: 2
收起左侧

求助!enwin的控件英文显示不全,怎么解决啊?

[复制链接]

2

主题

10

回帖

16

积分

新手上路

积分
16
发表于 2024-9-19 16:33:52 | 显示全部楼层 |阅读模式


enwin的BUTTON和TEXT的控件,英文显示不全,该怎么解决?

显示结果

显示结果
回复

使用道具 举报

2

主题

10

回帖

16

积分

新手上路

积分
16
 楼主| 发表于 2024-9-19 16:34:44 | 显示全部楼层
static const GUI_WIDGET_CREATE_INFO _aDialogCreate1[] = {
  { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 480, 272, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button1", ID_BUTTON_0, 18, 87, 88, 44, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button2", ID_BUTTON_1, 130, 87, 88, 44, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button3", ID_BUTTON_2, 245, 87, 88, 44, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button4", ID_BUTTON_3, 361, 87, 88, 44, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button5", ID_BUTTON_4, 18, 161, 88, 44, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button6", ID_BUTTON_5, 130, 161, 88, 44, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button7", ID_BUTTON_6, 245, 161, 88, 44, 0, 0x0, 0 },
  { BUTTON_CreateIndirect, "Button8", ID_BUTTON_7, 361, 161, 88, 44, 0, 0x0, 0 },
  { EDIT_CreateIndirect, "Edit", ID_EDIT_0, 48, 239, 80, 26, 0, 0x64, 0 },
  { TEXT_CreateIndirect, "Text", ID_TEXT_0, 370, 2, 112, 20, 0, 0x0, 0 },
  { TEXT_CreateIndirect, "Text", ID_TEXT_1, 368, 24, 112, 20, 0, 0x0, 0 },
  { EDIT_CreateIndirect, "Edit", ID_EDIT_1, 348, 239, 80, 26, 0, 0x64, 0 },
  { TEXT_CreateIndirect, "Frt", ID_TEXT_2, 109, 1, 237, 20, 0, 0x0, 0 },
  // USER START (Optionally insert additional widgets)
  // USER END
};

/*********************************************************************
*
*       Static code
*
**********************************************************************
*/


// USER START (Optionally insert additional static code)
// USER END

/*********************************************************************
*
*       _cbDialog
*/
static void _cbDialog1(WM_MESSAGE * pMsg) {
  WM_HWIN hItem;
  int     NCode;
  int     Id;
  char    buf[20];
  RTC_TimeTypeDef RTC_TimeStruct;
  RTC_DateTypeDef RTC_DateStruct;//                        //显示日期

  // USER START (Optionally insert additional variables)
  // USER END

  switch (pMsg->MsgId) {
  case WM_INIT_DIALOG:
    //
    // Initialization of 'Edit'
    //
GUI_SetFont(GUI_FONT_8X18);
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
    EDIT_SetText(hItem, "12345678");
    //
    // Initialization of 'Edit'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_1);
    EDIT_SetText(hItem, "123456.78");
       

    //
    // Initialization of 'Frist'
    //
    hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_2);
    TEXT_SetFont(hItem, GUI_FONT_16B_ASCII);
    TEXT_SetTextAlign(hItem, GUI_TA_HCENTER | GUI_TA_VCENTER);
    // USER START (Optionally insert additional code for further widget initialization)
    // USER END

    break;


    /* 定时器消息 */
  case WM_TIMER:   //--------------(1)

                //显示日期
                HAL_RTC_GetDate(&hrtc,&RTC_DateStruct,RTC_FORMAT_BIN);//获取日期
                sprintf((char*)buf,"20%02d-%02d-%02d",RTC_DateStruct.Year,RTC_DateStruct.Month,RTC_DateStruct.Date);
                TEXT_SetText(WM_GetDialogItem(pMsg->hWin, ID_TEXT_0), (const char*)buf);               
                //显示时间
                HAL_RTC_GetTime(&hrtc,&RTC_TimeStruct,RTC_FORMAT_BIN);//获取时间
                sprintf((char*)buf,"%02d:%02d:%02d",RTC_TimeStruct.Hours,RTC_TimeStruct.Minutes,RTC_TimeStruct.Seconds);        
                TEXT_SetText(WM_GetDialogItem(pMsg->hWin, ID_TEXT_1), (const char*)buf);

                WM_RestartTimer(pMsg->Data.v, 1000);
                break;
       
         case WM_KEY:
                switch (((WM_KEY_INFO*)(pMsg->Data.p))->Key)
                {
                        case GUI_KEY_ESCAPE:
                                        GUI_EndDialog(pMsg->hWin, 1);
                                        break;
                        case GUI_KEY_TAB:
                                 WM_SetFocusOnNextChild(pMsg->hWin);
                                 break;
                }
                break;

  case WM_NOTIFY_PARENT:
    Id    = WM_GetId(pMsg->hWinSrc);
    NCode = pMsg->Data.v;
    switch(Id) {
    case ID_BUTTON_0: // Notifications sent by 'Button1'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
          GUI_EndDialog(pMsg->hWin, 0);
          CreateSECOND();
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_1: // Notifications sent by 'Button2'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_2: // Notifications sent by 'Button3'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_3: // Notifications sent by 'Button4'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_4: // Notifications sent by 'Button5'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_5: // Notifications sent by 'Button6'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_6: // Notifications sent by 'Button7'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_BUTTON_7: // Notifications sent by 'Button8'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_0: // Notifications sent by 'Edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    case ID_EDIT_1: // Notifications sent by 'Edit'
      switch(NCode) {
      case WM_NOTIFICATION_CLICKED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_RELEASED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      case WM_NOTIFICATION_VALUE_CHANGED:
        // USER START (Optionally insert code for reacting on notification message)
        // USER END
        break;
      // USER START (Optionally insert additional code for further notification handling)
      // USER END
      }
      break;
    // USER START (Optionally insert additional code for further Ids)
    // USER END
    }
    break;
  // USER START (Optionally insert additional message handling)
  // USER END
  default:
    WM_DefaultProc(pMsg);
    break;
  }
}

/*********************************************************************
*
*       Public code
*
**********************************************************************
*/
/*********************************************************************
*
*       CreateWindow
*/

WM_HWIN CreateWindow(void) {
  WM_HWIN hWin;
  WM_HTIMER hTimer;
  hWin = GUI_CreateDialogBox(_aDialogCreate1, GUI_COUNTOF(_aDialogCreate1), _cbDialog1, WM_HBKWIN, 0, 0);
        WM_SetFocus(hWin);
  /* 给对话框hDlg创建定时器,溢出时间是100ms */
  hTimer = WM_CreateTimer(hWin, 0, 1000, 0); //--------------(2)

  return hWin;
}

void MainTask1(void)
{
    /* 初始化 */
    //GUI_Init();
   
    /* 窗口自动使用存储设备 */
    WM_SetCreateFlags(WM_CF_MEMDEV);

//    /* 创建对话框,使用GUIBulder生成的对话框创建函数 */
//          GUI_SetFont(GUI_FONT_8X18);
//                GUI_DispStringAt("Frist",0,0);
//                GUI_DispStringAt("Button1",0,32);          
    CreateWindow();


    while (1)
    {
        GUI_Delay(100);
    }
}
回复

使用道具 举报

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
117512
QQ
发表于 2024-9-20 09:15:04 | 显示全部楼层
shuangrenyu 发表于 2024-9-19 16:34
static const GUI_WIDGET_CREATE_INFO _aDialogCreate1[] = {
  { WINDOW_CreateIndirect, "Window", ID_W ...

调用下按钮字体设置API,看楼主的代码里面貌似没有设置。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-8-12 03:37 , Processed in 0.040840 second(s), 28 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表