|
发表于 2014-11-25 22:00:59
|
显示全部楼层
abcdotaabc:
我刚测试了下 是非阻塞式的 最后那句话意思让自己创建阻塞式对话框来操作吗?没有在小工具找修改按钮大小 边框大小的相关函数,这些好像都是创建的时候就定义好了的 官方有个例子的:DIALOG_MessageBoxUser.c
下面是源码的一部分,教你如何设置这个消息窗口了:
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
/*********************************************************************
*
* _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 - 15,
Rect.y0 - 15,
Rect.x1 - Rect.x0 + 1 + 30,
Rect.y1 - Rect.y0 + 1 + 30);
//
// 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,
Rect.y0 + 10,
Rect.x1 - Rect.x0 + 1 + 30,
Rect.y1 - Rect.y0 + 1 + 5);
//
// 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,
Rect.y0,
Rect.x1 - Rect.x0 + 1 + 30,
Rect.y1 - Rect.y0 + 1 + 12);
return hWin;
}
/*********************************************************************
*
* _EnableSkinning
*/
static void _EnableSkinning(void) {
FRAMEWIN_SetDefaultSkin(FRAMEWIN_SKIN_FLEX);
BUTTON_SetDefaultSkin (BUTTON_SKIN_FLEX);
}
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* MainTask
*/
void MainTask(void) {
GUI_Init();
_EnableSkinning();
while (1) {
GUI_SetFont(&GUI_Font20B_ASCII);
GUI_DispStringHCenterAt("Applicatoin defined MESSAGEBOX", 160, 5);
GUI_ExecCreatedDialog(_CreateMessageBox("Message", "Caption", 0, &GUI_Font24));
GUI_Clear();
GUI_Delay(1000);
}
} |
|