完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我想用按键1控件创建WM_CreateWindowAsChild(子窗口) 按键2删除这个字窗口 怎么实现 谢谢
#include "pbdata.h" void RCC_Configuration(void); void GPIO_Configuration(void); void LED_GPIO(void); static void cbCallbsck(WM_MESSAGE* pMsg) { int NCode,Id; switch(pMsg->MsgId) { case WM_PAINT: { GUI_SetBkColor(GUI_BLACK); GUI_Clear(); GUI_SetFont(&GUI_Font24_ASCII); GUI_SetColor(GUI_GREEN); GUI_DispStringAt("www.ssdf.com",40,280); } break; case WM_NOTIFY_PARENT: { Id=WM_GetId(pMsg->hWinSrc); NCode = pMsg->Data.v; switch(NCode) { case WM_NOTIFICATION_RELEASED: { switch(Id) { case GUI_ID_BUTTON0: { GPIO_ResetBits(GPIOB,GPIO_Pin_5); } break; case GUI_ID_BUTTON1: { GPIO_SetBits(GPIOB,GPIO_Pin_5); } break; case GUI_ID_BUTTON2: { GPIO_ResetBits(GPIOD,GPIO_Pin_3); } break; case GUI_ID_BUTTON3: { GPIO_SetBits(GPIOD,GPIO_Pin_3); } break; case GUI_ID_BUTTON4: { GPIO_ResetBits(GPIOD,GPIO_Pin_6); } break; case GUI_ID_BUTTON5: { GPIO_SetBits(GPIOD,GPIO_Pin_6); } break; } } break; } } break; default: WM_DefaultProc(pMsg); } } int main(void) { WM_HWIN hWin; TEXT_Handle hText0,hText1,hText2,hText3; BUTTON_Handle hButton; RCC_Configuration(); GPIO_Configuration(); LED_GPIO(); FSMC_Configuration(); SPI1_Configuration(); Touch_GPIO(); ILI9325_Init(); GUI_Init(); //′′½¨′°ìå hWin=WM_CreateWindow (0,0,240,320,WM_CF_SHOW,cbCallbsck,0); //Îı¾¿Ø¼tÏÔê¾éèÖà hText0=TEXT_CreateAsChild (0,0,240,40,hWin,GUI_ID_TEXT0,WM_CF_SHOW,"LCD UC/GUI",GUI_TA_HCENTER);//′˾ä±ØDëÔúé챧 TEXT_SetFont(hText0,&GUI_Font24_ASCII); TEXT_SetTextColor(hText0,GUI_RED); TEXT_SetBkColor(hText0,GUI_BLUE); hText1=TEXT_CreateAsChild (20,50,60,40,hWin,GUI_ID_TEXT1,WM_CF_SHOW,"LCD1",GUI_TA_HCENTER); TEXT_SetFont(hText1,&GUI_Font24_ASCII); TEXT_SetTextColor(hText1,GUI_RED); // TEXT_SetBkColor(hText1,GUI_BLUE); hText2=TEXT_CreateAsChild (90,50,60,40,hWin,GUI_ID_TEXT2,WM_CF_SHOW,"LCD2",GUI_TA_HCENTER); TEXT_SetFont(hText2,&GUI_Font24_ASCII); TEXT_SetTextColor(hText2,GUI_RED); //TEXT_SetBkColor(hText2,GUI_BLUE); hText3=TEXT_CreateAsChild (160,50,60,40,hWin,GUI_ID_TEXT3,WM_CF_SHOW,"LCD3",GUI_TA_HCENTER); TEXT_SetFont(hText3,&GUI_Font24_ASCII); TEXT_SetTextColor(hText3,GUI_RED); //TEXT_SetBkColor(hText3,GUI_BLUE); //°′Å¥¿Ø¼t hButton=BUTTON_CreateAsChild (20,70, 60,40,hWin,GUI_ID_BUTTON0,WM_CF_SHOW); BUTTON_SetFont(hButton,&GUI_Font24_ASCII);//éèÖÃ×Öìå BUTTON_SetText(hButton,"ON"); BUTTON_SetTextColor(hButton,0, GUI_WHITE); BUTTON_SetTextColor(hButton,1, GUI_BLACK); BUTTON_SetBkColor(hButton,0, GUI_BLUE); BUTTON_SetBkColor(hButton,1, GUI_RED); hButton=BUTTON_CreateAsChild (20,140, 60,40,hWin,GUI_ID_BUTTON1,WM_CF_SHOW); BUTTON_SetFont(hButton,&GUI_Font24_ASCII); BUTTON_SetText(hButton,"OFF"); BUTTON_SetTextColor(hButton,0, GUI_WHITE); BUTTON_SetTextColor(hButton,1, GUI_BLACK); BUTTON_SetBkColor(hButton,0, GUI_BLUE); BUTTON_SetBkColor(hButton,1, GUI_RED); hButton=BUTTON_CreateAsChild (90,70, 60,40,hWin,GUI_ID_BUTTON2,WM_CF_SHOW); BUTTON_SetFont(hButton,&GUI_Font24_ASCII); BUTTON_SetText(hButton,"ON"); BUTTON_SetTextColor(hButton,0, GUI_WHITE); BUTTON_SetTextColor(hButton,1, GUI_BLACK); BUTTON_SetBkColor(hButton,0, GUI_BLUE); BUTTON_SetBkColor(hButton,1, GUI_RED); hButton=BUTTON_CreateAsChild (90,140, 60,40,hWin,GUI_ID_BUTTON3,WM_CF_SHOW); BUTTON_SetFont(hButton,&GUI_Font24_ASCII); BUTTON_SetText(hButton,"OFF"); BUTTON_SetTextColor(hButton,0, GUI_WHITE); BUTTON_SetTextColor(hButton,1, GUI_BLACK); BUTTON_SetBkColor(hButton,0, GUI_BLUE); BUTTON_SetBkColor(hButton,1, GUI_RED); hButton=BUTTON_CreateAsChild (160,70, 60,40,hWin,GUI_ID_BUTTON4,WM_CF_SHOW); BUTTON_SetFont(hButton,&GUI_Font24_ASCII); BUTTON_SetText(hButton,"ON"); BUTTON_SetTextColor(hButton,0, GUI_WHITE); BUTTON_SetTextColor(hButton,1, GUI_BLACK); BUTTON_SetBkColor(hButton,0, GUI_BLUE); BUTTON_SetBkColor(hButton,1, GUI_RED); hButton=BUTTON_CreateAsChild (160,140, 60,40,hWin,GUI_ID_BUTTON5,WM_CF_SHOW); BUTTON_SetFont(hButton,&GUI_Font24_ASCII); BUTTON_SetText(hButton,"OFF"); BUTTON_SetTextColor(hButton,0, GUI_WHITE); BUTTON_SetTextColor(hButton,1, GUI_BLACK); BUTTON_SetBkColor(hButton,0, GUI_BLUE); BUTTON_SetBkColor(hButton,1, GUI_RED); GUI_CURSOR_Show(); while(1) { GUI_TOUCH_Exec(); WM_Exec(); delay_ms(20); } } |
|
相关推荐
1个回答
|
|
你可以先看看emwin开发手册的增删说明
|
|
|
|
只有小组成员才能发言,加入小组>>
698 浏览 0 评论
1109 浏览 1 评论
2476 浏览 5 评论
2810 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2653 浏览 6 评论
使用eim外接fpga可是端口一点反应都没有有没有大哥指点一下啊
656浏览 9评论
651浏览 7评论
请教大神怎样去解决iMX6Q在linux3.0.35内核上做AP失败的问题呢
784浏览 6评论
632浏览 5评论
672浏览 5评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 01:49 , Processed in 1.022865 second(s), Total 78, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号