EMWin对话框(Diolog)通知框(Messa…

来源:互联网 发布:我想当淘宝主播怎么做 编辑:程序博客网 时间:2024/05/15 11:01
实例:DIALOG_MessageBox.c
效果:
EMWin对话框(Diolog)通知框(Message_Box)学习



#include "GUI.h"
#include "WM.h"



static void _cbBkWindow(WM_MESSAGE* pMsg) {
  switch (pMsg->MsgId) {
  case WM_PAINT:
   GUI_SetBkColor(GUI_RED);
   GUI_Clear();
   GUI_SetColor(GUI_WHITE);
   GUI_SetFont(&GUI_Font24_ASCII);
   GUI_DispStringHCenterAt("DIALOG_MessageBox - Sample", 160,5);
    break;
  default:
   WM_DefaultProc(pMsg);
  }
}



void MainTask(void) {
  GUI_Init();
  #if GUI_SUPPORT_MEMDEV
   WM_SetCreateFlags(WM_CF_MEMDEV);
  #endif
  WM_SetCallback(WM_HBKWIN,&_cbBkWindow);
  //
  // Create message box and wait until it isclosed
  //
  while (1) {
   GUI_MessageBox("This text is shown\nin a message box",
                  "Caption/Title", GUI_MESSAGEBOX_CF_MOVEABLE);
   GUI_Delay(750);                   // Wait for a short moment ...
   GUI_MessageBox("New message !",
                  "Caption/Title", GUI_MESSAGEBOX_CF_MOVEABLE);
   GUI_Delay(750);
  }
}