Exemplo n.º 1
0
//----移动窗口------------------------------------------------------------------
//描述: 移动一个窗口位置,包括子窗口.
//参数:hwnd:窗口句柄.
//      x,y: 相对于父窗口客户区坐标位置.
//返回:TRUE:成功;FALSE:失败.
//------------------------------------------------------------------------------
BOOL    MoveWindow(HWND hwnd,int x,int y)
{
    if(HWND_Lock(hwnd))
    {
        _MoveWindow(hwnd,x,y);
        HWND_Unlock(hwnd);
        return TRUE;
    }
    return FALSE;
}
/*******************************************************************
*
*       _DemoRedraw
*/
static void _DemoRedraw(void) {
  WM_CALLBACK* _cbOldBk;
  GUI_SetBkColor(GUI_BLACK);
  GUI_Clear();
  GUI_SetColor(GUI_WHITE);
  GUI_SetFont(&GUI_Font24_ASCII);
  GUI_DispStringHCenterAt("WM_Redraw - Sample", 160, 5);
  GUI_SetFont(&GUI_Font8x16);
  while(1) {
    /* Move a window over background */
    _MoveWindow("Background has not been redrawn");
    /* Clear background */
    GUI_ClearRect(0, 50, 319, 239);
    GUI_Delay(1000);
    /* Set callback for background window */
    _cbOldBk = WM_SetCallback(WM_HBKWIN, _cbBkWindow);
    /* Move a window over background */
    _MoveWindow("Background has been redrawn");
    /* Delete callback for Background window */
    WM_SetCallback(WM_HBKWIN, _cbOldBk);
  }
}