Hello.
I need to draw a line above a text.
The text is created using a dialog box
Whne I try to draw the line in WM_PAINT message, the line is drawn bellow the text.
Note that the text has a background collor.
Here is the example code:
Display All
The result is :
I need to draw a line above a text.
The text is created using a dialog box
Whne I try to draw the line in WM_PAINT message, the line is drawn bellow the text.
Note that the text has a background collor.
Here is the example code:
Source Code
- #define ID_WINDOW_0 (GUI_ID_USER + 0x00)
- #define ID_TEXT_0 (GUI_ID_USER + 0x02)
- // USER START (Optionally insert additional defines)
- // USER END
- /*********************************************************************
- *
- * Static data
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static data)
- // USER END
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
- { WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 320, 240, 0, 0x0, 0 },
- { TEXT_CreateIndirect, "Text", ID_TEXT_0, 50, 130, 320, 82, 0, 0x0, 0 },
- // USER START (Optionally insert additional widgets)
- // USER END
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialog(WM_MESSAGE * pMsg) {
- // USER START (Optionally insert additional variables)
- // USER END
- WM_HWIN hItem;
- switch (pMsg->MsgId) {
- // USER START (Optionally insert additional message handling)
- // USER END
- case WM_INIT_DIALOG:
- hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
- TEXT_SetText(hItem, "Text");
- TEXT_SetBkColor(hItem, GUI_YELLOW);
- case WM_PAINT :
- GUI_SetColor(GUI_BLACK);
- GUI_SetPenSize(1);
- GUI_DrawLine(0, 0, 320, 240);
- break;
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- WM_HWIN CreateWindow22(void)
- {
- WM_HWIN hWin;
- hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
- return hWin;
- }
- void MainTask(void) {
- GUI_Init();
- CreateWindow22();
- while (1)
- {
- GUI_Exec();
- }
- }
The result is :