⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winhello.c

📁 cpc-1631的BSP包for VxWorks操作系统
💻 C
字号:
#include <ugl/uglWin.h>

/***************************************************************************
*
* cbDraw - draw the "Hellow World" window
*
*/

UGL_LOCAL UGL_STATUS cbDraw
    (
    WIN_ID          winId,      /* window ID */                                
    WIN_MSG *       pMsg,       /* message (always MSG_DRAW) */                                    
    void *          pData,      /* copy of data passed to winCreate() */               
    void *          pParam      /* parameter passed to winCbAdd() */  
    )
    {
    /* draw the background */

    uglLineWidthSet (pMsg->data.draw.gcId, 0);
    uglBackgroundColorSet (pMsg->data.draw.gcId, WIN_LIGHTBLUE);

    uglRectangle (pMsg->data.draw.gcId, pMsg->data.draw.rect.left, 
                  pMsg->data.draw.rect.top, pMsg->data.draw.rect.right, 
                  pMsg->data.draw.rect.bottom);

    /* draw the text */

    uglFontSet (pMsg->data.draw.gcId, WIN_FONT_SYSTEM);
    uglTextDraw (pMsg->data.draw.gcId, 10, 10, -1, "Hello World!");

    /* return UGL_STATUS_FINISHED because default handling not needed */

    return (UGL_STATUS_FINISHED);
    }


/***************************************************************************
*
* winHello - run the "Hello World!" tutorial program.
*
*/
    
void winHello (void)
    {
    WIN_APP_ID      appId;
    WIN_ID          winId;

    /* create the application context */

    appId = winAppCreate ("winHello", 0, 0, 0, UGL_NULL);

    /* create the window */

    winId = winCreate (appId, UGL_NULL_ID, 
                       WIN_ATTRIB_FRAMED | WIN_ATTRIB_VISIBLE, 
                       100, 100, 200, 150, UGL_NULL, 0, UGL_NULL);

    /* add the draw callback */

    winCbAdd (winId, MSG_DRAW, 0, cbDraw, UGL_NULL);

    /* attach the window to the default display */

    winAttach (winId, UGL_NULL_ID, UGL_NULL_ID);
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -