#include <stddef.h>
#include "GUI.h"
#include "DIALOG.h"
#include "DROPDOWN.h"
static void cbBackgroundWin(WM_MESSAGE* pMsg)
{
switch (pMsg->MsgId)
{
case WM_PAINT: GUI_Clear();
default: WM_DefaultProc(pMsg);
}
}
static void cbForegroundWin(WM_MESSAGE* pMsg)
{
switch (pMsg->MsgId)
{
case WM_PAINT: GUI_SetBkColor(GUI_GREEN);
GUI_Clear();
GUI_DispString("Foreground window");
default: WM_DefaultProc(pMsg);
}
}
static void DemoRedraw(void)
{
GUI_HWIN hWnd;
while(1)
{
hWnd = WM_CreateWindow(100, 100, 200, 200, WM_CF_SHOW, cbForegroundWin, 0);
GUI_Delay(5000);
WM_DeleteWindow(hWnd);
GUI_DispStringAt("hWnd Deleted Background of window has not been redrawn", 20, 20);
GUI_Delay(5000);
GUI_Clear();
WM_SetCallback(WM_HBKWIN, cbBackgroundWin);
hWnd = WM_CreateWindow(100, 100, 200, 200,WM_CF_SHOW, cbForegroundWin, 0);
GUI_Delay(5000);
WM_DeleteWindow(hWnd);
GUI_DispStringAt("hWnd Deleted Background of window has been redrawn", 20, 20);
GUI_Delay(5000);
WM_SetCallback(WM_HBKWIN, 0);
}
}
void MainTask(void)
{
GUI_Init();
DemoRedraw();
}
ucgui的callback的小例子
最新推荐文章于 2021-12-30 16:18:45 发布