[ucgui] 子窗口父窗口
2024-10-19 06:25:21
它创建了3个窗口:
- 第一个作为桌面的子窗口
- 第二个作为第一个窗口的子窗口
- 第三个作为第二个窗口的子窗口
窗口创建后,使用WM_ForEachDesc()在其父窗口中移动各个窗口:
static void _cbWin(WM_MESSAGE * pMsg) {
GUI_COLOR Color;
switch (pMsg->MsgId) {
case WM_PAINT:
WM_GetUserData(pMsg->hWin, &Color, );
GUI_SetBkColor(Color);
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
}
}
/*********************************************************************
*
* _cbDoSomething
*/
static void _cbDoSomething(WM_HWIN hWin, void * p) {
int Value = *(int *)p;
WM_MoveWindow(hWin, Value, Value);
}
/*********************************************************************
*
* MainTask
*/
void Fun(void) {
WM_HWIN hWin_1, hWin_2, hWin_3;
int Value = ;
GUI_COLOR aColor[] = {GUI_RED, GUI_GREEN, GUI_BLUE};
GUI_Init();
WM_SetDesktopColor(GUI_BLACK);
hWin_1 = WM_CreateWindow( , , , , WM_CF_SHOW, _cbWin, );
hWin_2 = WM_CreateWindowAsChild(, , , , hWin_1, WM_CF_SHOW, _cbWin, );
hWin_3 = WM_CreateWindowAsChild(, , , , hWin_2, WM_CF_SHOW, _cbWin, );
WM_SetUserData(hWin_1, &aColor[], );
WM_SetUserData(hWin_2, &aColor[], );
WM_SetUserData(hWin_3, &aColor[], );
while () {
WM_ForEachDesc(WM_HBKWIN, _cbDoSomething, (void *)&Value);
Value *= -;
GUI_Delay();
}
}
- 前两个为回调函数,Fun函数为主函数,建立3个窗口
- WM_HWIN WM_CreateWindow(int x0, int y0,
int width, int height,
U8 Style, WM_CALLBACK * cb
int NumExtraBytes); - WM_HWIN WM_CreateWindowAsChild(int x0, int y0,
int width, int height,
WM_HWIN hWinParent,
U8 Style,
WM_CALLBACK* cb
int NumExtraBytes); - void WM_ForEachDesc(WM_HWIN hWin, WM_tfForEach * pcb, void * pData);
最新文章
- docker-compose启动报错,解决方案
- java6
- PPP 转义字符 编码 和 解码
- Alpha版本十天冲刺——Day 9
- picasso-强大的Android图片下载缓存库
- 关于C#中get和set
- Linux中部署JAVA程序
- 创Wcf案例数据服务
- 8.19! 今天我有18生日,点击阅读或顶部 尾随幸运的一天!生日知识!↓——【Badboy】
- php面向对象中的魔术方法
- 面向对象之组合VS继承:继承过时了?
- python 数据分析算法(决策树)
- 一个狗血的mysql编码错误
- flask上下文(new)
- idHTTP 向网站发送json格式数据
- Vue 命令
- springcloud之Hystrix
- win7/win8下手工搭建WAMP环境
- 【android】开发中遇到的一些问题
- JDBC基本操作示例