中级会员
 
- 积分
- 494
- 金钱
- 494
- 注册时间
- 2017-10-14
- 在线时间
- 76 小时
|

楼主 |
发表于 2018-3-27 22:15:41
|
显示全部楼层
感觉自己真的很蠢,Messagebox_Create();函数果然是可以的,但是无法改变窗体大小,按钮大小等,于是我使用了_CreateMessageBox("Not response!","Caption", 0, GUI_FONT_24B_ASCII)此函数,只要不要建立阻塞式窗口就可以虽然不点击OK按钮关闭,下次窗口还是可以建立起来的,,,在回调函数中可以改变窗口属性...........
在下面函数中改变窗口属性
/*********************************************************************
*
* _CreateMessageBox
*/
static WM_HWIN _CreateMessageBox(const char *sMessage, const char * sCaption, int Flags, const GUI_FONT * pFont) {
WM_HWIN hWin;
WM_HWIN hItem;
GUI_RECT Rect;
hWin =MESSAGEBOX_Create(sMessage, sCaption, Flags);
//
// Change font of message box window
//
FRAMEWIN_SetFont(hWin, pFont);
//
// Adjust size
//
WM_GetWindowRectEx(hWin, &Rect);
WM_SetWindowPos(hWin, Rect.x0 - 70,
Rect.y0 - 70,
Rect.x1 - Rect.x0 + 1 +140,
Rect.y1 - Rect.y0 + 1 +140);
//
// Change font of button widget
//
hItem =WM_GetDialogItem(hWin, GUI_ID_OK);
BUTTON_SetFont(hItem, pFont);
//
// Adjust size of button widget
//
WM_GetWindowRectEx(hItem, &Rect);
WM_SetWindowPos(hItem, Rect.x0 +40,
Rect.y0 + 70,
Rect.x1 - Rect.x0 + 1+ 70,
Rect.y1 - Rect.y0 + 1+ 20);
//
// Change font of text widget
//
hItem =WM_GetDialogItem(hWin, GUI_ID_TEXT0);
TEXT_SetFont(hItem, pFont);
//
// Adjust size text widget
//
WM_GetWindowRectEx(hItem, &Rect);
WM_SetWindowPos(hItem, Rect.x0+5,
Rect.y0+30,
Rect.x1 - Rect.x0 + 1+ 120,
Rect.y1 - Rect.y0 + 1+ 40);
WM_SetFocus(hWin);
return hWin;
} |
|