//初始化函数 BOOL CChessManual::OnInitDialog() { __super::OnInitDialog(); //设置标题 SetWindowText(TEXT("中国象棋棋谱:")); //移动窗口 CImageHandle ImageHandeBack(&m_ImageBack); SetWindowPos(NULL,0,0,m_ImageBack.GetWidth(),m_ImageBack.GetHeight(),SWP_NOZORDER|SWP_NOMOVE); //获取大小 CRect rcClient; GetClientRect(&rcClient); //创建控件 const CSize & BoradSize=m_ChessBorad.GetChessBoradSize(); m_ChessBorad.Create(NULL,NULL,WS_CHILD|WS_VISIBLE,CRect(0,0,0,0),this,10); //设置按钮 HINSTANCE hInstance=AfxGetInstanceHandle(); m_btOpen.SetButtonImage(IDB_MANUAL_BT_OPEN,hInstance,false); m_btReLoad.SetButtonImage(IDB_MANUAL_BT_RELOAD,hInstance,false); m_btFirst.SetButtonImage(IDB_MANUAL_BT_FIRST,hInstance,false); m_btBefore.SetButtonImage(IDB_MANUAL_BT_BEFORE,hInstance,false); m_btNext.SetButtonImage(IDB_MANUAL_BT_NEXT,hInstance,false); m_btLast.SetButtonImage(IDB_MANUAL_BT_LAST,hInstance,false); m_btCancel.SetButtonImage(IDB_MANUAL_BT_CLOSE,hInstance,false); //计算位置 CRect rcButton; m_btOpen.GetWindowRect(&rcButton); int nXButtonSpace=(rcClient.Width()-rcButton.Width()*7)/8; int nYPos=rcClient.Height()-rcButton.Height()-30; //移动按钮 HDWP hDwp=BeginDeferWindowPos(7); const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS|SWP_NOSIZE; DeferWindowPos(hDwp,m_btOpen,NULL,nXButtonSpace,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btReLoad,NULL,nXButtonSpace*2+rcButton.Width(),nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btFirst,NULL,nXButtonSpace*3+rcButton.Width()*2,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btBefore,NULL,nXButtonSpace*4+rcButton.Width()*3,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btNext,NULL,nXButtonSpace*5+rcButton.Width()*4,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btLast,NULL,nXButtonSpace*6+rcButton.Width()*5,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btCancel,NULL,nXButtonSpace*7+rcButton.Width()*6,nYPos,0,0,uFlags); EndDeferWindowPos(hDwp); //移动控件 m_ChessBorad.MoveWindow(29,29,BoradSize.cx,BoradSize.cy); m_ManualList.MoveWindow(BoradSize.cx+37,32,rcClient.Width()-BoradSize.cx-66,BoradSize.cy-8); //更新棋谱 OnReLoad(); return TRUE; }
VOID EtwDiskNetworkLayoutGraphs( _In_ PET_DISKNET_CONTEXT Context ) { HDWP deferHandle; RECT clientRect; RECT panelRect; RECT margin = { PH_SCALE_DPI(13), PH_SCALE_DPI(13), PH_SCALE_DPI(13), PH_SCALE_DPI(13) }; RECT innerMargin = { PH_SCALE_DPI(10), PH_SCALE_DPI(20), PH_SCALE_DPI(10), PH_SCALE_DPI(10) }; LONG between = PH_SCALE_DPI(3); ULONG graphWidth; ULONG graphHeight; PhLayoutManagerLayout(&Context->LayoutManager); Context->DiskGraphState.Valid = FALSE; Context->NetworkGraphState.Valid = FALSE; GetClientRect(Context->WindowHandle, &clientRect); // Limit the rectangle bottom to the top of the panel. GetWindowRect(Context->PanelHandle, &panelRect); MapWindowPoints(NULL, Context->WindowHandle, (PPOINT)&panelRect, 2); clientRect.bottom = panelRect.top + 10; // +10 removing extra spacing graphWidth = clientRect.right - margin.left - margin.right; graphHeight = (clientRect.bottom - margin.top - margin.bottom - between * 2) / 2; deferHandle = BeginDeferWindowPos(4); deferHandle = DeferWindowPos(deferHandle, Context->DiskGroupBox, NULL, margin.left, margin.top, graphWidth, graphHeight, SWP_NOACTIVATE | SWP_NOZORDER); deferHandle = DeferWindowPos( deferHandle, Context->DiskGraphHandle, NULL, margin.left + innerMargin.left, margin.top + innerMargin.top, graphWidth - innerMargin.left - innerMargin.right, graphHeight - innerMargin.top - innerMargin.bottom, SWP_NOACTIVATE | SWP_NOZORDER ); deferHandle = DeferWindowPos(deferHandle, Context->NetworkGroupBox, NULL, margin.left, margin.top + graphHeight + between, graphWidth, graphHeight, SWP_NOACTIVATE | SWP_NOZORDER); deferHandle = DeferWindowPos( deferHandle, Context->NetworkGraphHandle, NULL, margin.left + innerMargin.left, margin.top + graphHeight + between + innerMargin.top, graphWidth - innerMargin.left - innerMargin.right, graphHeight - innerMargin.top - innerMargin.bottom, SWP_NOACTIVATE | SWP_NOZORDER ); EndDeferWindowPos(deferHandle); }
void CTestClockDlg::OnSize(UINT nType, int cx, int cy) { if (m_bInit == TRUE) { SetRadius(cx, cy); SetCenterPoint(cx, cy); SetGradationPoints(); m_nHourGradSize = MulDiv(DEFAULT_HOUR_GRAD_SIZE, m_nRadius, m_nRadiusOrg); m_nMinuteGradSize = MulDiv(DEFAULT_MINUTE_GRAD_SIZE, m_nRadius, m_nRadiusOrg); m_nSecondHandSize = MulDiv(DEFAULT_SECOND_HAND_SIZE, m_nRadius, m_nRadiusOrg); m_nCenterPointSize = MulDiv(DEFAULT_CENTER_POINT_SIZE, m_nRadius, m_nRadiusOrg); SetClockHandPoints(); // Set position of the 'OK' and 'Cancel' button CRect rect; CRect rectBtnOk; CRect rectBtnOkToMove; CRect rectBtnCancel; CRect rectBtnCancelToMove; GetClientRect(rect); ClientToScreen(rect); m_btnOk.GetWindowRect(rectBtnOk); ScreenToClient(rectBtnOk); m_btnCancel.GetWindowRect(rectBtnCancel); ScreenToClient(rectBtnCancel); rectBtnOkToMove.right = rect.Width() - m_marginBtnOk.right; rectBtnOkToMove.bottom = rect.Height() - m_marginBtnOk.bottom; rectBtnOkToMove.left = rectBtnOkToMove.right - rectBtnOk.Width(); rectBtnOkToMove.top = rectBtnOkToMove.bottom - rectBtnOk.Height(); rectBtnCancelToMove.right = rect.Width() - m_marginBtnCancel.right; rectBtnCancelToMove.bottom = rect.Height() - m_marginBtnCancel.bottom; rectBtnCancelToMove.left = rectBtnCancelToMove.right - rectBtnCancel.Width(); rectBtnCancelToMove.top = rectBtnCancelToMove.bottom - rectBtnCancel.Height(); HDWP hdwp = ::BeginDeferWindowPos(2); if (hdwp) hdwp = DeferWindowPos(hdwp, m_btnOk.GetSafeHwnd(), HWND_TOP, rectBtnOkToMove.left, rectBtnOkToMove.top, rectBtnOkToMove.Width(), rectBtnOkToMove.Height(), SWP_NOZORDER); if (hdwp) DeferWindowPos(hdwp, m_btnCancel.GetSafeHwnd(), HWND_TOP, rectBtnCancelToMove.left, rectBtnCancelToMove.top, rectBtnCancelToMove.Width(), rectBtnCancelToMove.Height(), SWP_NOZORDER); if (hdwp) EndDeferWindowPos(hdwp); Invalidate(); UpdateWindow(); } CDialog::OnSize(nType, cx, cy); }
void CConsoleWindow::Layout() { RECT rc; GetClientRect(&rc); HDWP hdwp = BeginDeferWindowPos(1); hdwp = m_LoggerConsole.DeferWindowPos(hdwp, NULL, 0, 0, rc.right, rc.bottom, SWP_NOZORDER); EndDeferWindowPos(hdwp); }
static void ResizeWnd(int cx, int cy) { HDWP hdwp = BeginDeferWindowPos(2); RECT rt = {0, 0, cx, cy}; cx = g_pChildWnd->nSplitPos + SPLIT_WIDTH/2; DeferWindowPos(hdwp, g_pChildWnd->hTreeWnd, 0, rt.left, rt.top, g_pChildWnd->nSplitPos-SPLIT_WIDTH/2-rt.left, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); DeferWindowPos(hdwp, g_pChildWnd->hListWnd, 0, rt.left+cx , rt.top, rt.right-cx, rt.bottom-rt.top, SWP_NOZORDER|SWP_NOACTIVATE); EndDeferWindowPos(hdwp); }
void Test_OneParamRoutine_BeginDeferWindowPos(void) /* 0x1e */ { HDWP hWinPosInfo; hWinPosInfo = (HDWP)NtUserCallOneParam(5, 0x1e); TEST(hWinPosInfo != 0); TEST(EndDeferWindowPos(hWinPosInfo) != 0); }
void ResizeManager::HandleSize(int cx, int cy) { ClientRect clnt_rect(_hwnd); SIZE new_size = {cx, cy}; int dx = new_size.cx - _last_size.cx; int dy = new_size.cy - _last_size.cy; if (!dx && !dy) return; _last_size = new_size; HDWP hDWP = BeginDeferWindowPos(size()); for(ResizeManager::const_iterator it=begin(); it!=end(); ++it) { const ResizeEntry& e = *it; RECT move = {0}; if (e._flags & MOVE_LEFT) // Die verschiedenen Transformationsmatrizen in move ließen sich eigentlich move.left += dx; // cachen oder vorausberechnen, da sie nur von _flags und der Größenänderung abhängig sind. if (e._flags & MOVE_RIGHT) move.right += dx; if (e._flags & MOVE_TOP) move.top += dy; if (e._flags & MOVE_BOTTOM) move.bottom += dy; UINT flags = 0; if (!move.left && !move.top) flags = SWP_NOMOVE; if (move.right==move.left && move.bottom==move.top) flags |= SWP_NOSIZE; if (flags != (SWP_NOMOVE|SWP_NOSIZE)) { HWND hwnd = GetDlgItem(_hwnd, e._id); WindowRect rect(hwnd); ScreenToClient(_hwnd, rect); rect.left += move.left; rect.right += move.right; rect.top += move.top; rect.bottom += move.bottom; hDWP = DeferWindowPos(hDWP, hwnd, 0, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, flags|SWP_NOACTIVATE|SWP_NOZORDER); } } EndDeferWindowPos(hDWP); }
//调整控件 void CGameFrameControl::RectifyControl(int nWidth, int nHeight) { //状态判断 if (m_bInitDialog==false) return; if ((nWidth==0)||(nHeight==0)) return; //变量定义 const int nComminutePos=nHeight*3/7; const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS; //移动控件 HDWP hDwp=BeginDeferWindowPos(20); //广告区域 DeferWindowPos(hDwp,m_BrowerAD,NULL,LIST_LEFT,7,nWidth-LIST_LEFT-LIST_RIGHT,115,uFlags); //列表区域 DeferWindowPos(hDwp,m_UserListView,NULL,LIST_LEFT,LIST_TOP,nWidth-LIST_LEFT-LIST_RIGHT,nComminutePos-LIST_TOP-LIST_BOTTOM,uFlags); //聊天区域 DeferWindowPos(hDwp,m_ChatMessage,NULL,CHAT_LEFT,nComminutePos+CHAT_TOP,nWidth-CHAT_RIGHT-CHAT_LEFT, nHeight-nComminutePos-CHAT_TOP-CHAT_BOTTOM,uFlags); //聊天区域 CRect rcButton; m_btPhrase.GetWindowRect(&rcButton); CButton * pButtonArray[]={&m_btExpression,&m_btColorSet,&m_btCleanScreen}; for (int i=0;i<CountArray(pButtonArray);i++) { DeferWindowPos(hDwp,pButtonArray[i]->m_hWnd,NULL,CHAT_LEFT+(rcButton.Width()+5)*i,nHeight-61,rcButton.Width(),rcButton.Height(),uFlags); } m_btSendChat.GetWindowRect(&rcButton); DeferWindowPos(hDwp,m_btSendChat,NULL,nWidth-rcButton.Width()-8,nHeight-33,rcButton.Width(),rcButton.Height(),uFlags); DeferWindowPos(hDwp,m_ChatObject,NULL,8,nHeight-33,70,200,uFlags); DeferWindowPos(hDwp,m_ChatInput,NULL,81,nHeight-33,nWidth-rcButton.Width()-93,19,uFlags); //功能按钮 m_btSound.GetWindowRect(&rcButton); int nBeginPos=22,nEndPos=nWidth-17; int nButtonSpace=(nEndPos-nBeginPos-4*rcButton.Width())/3,nYPosButton=nComminutePos-rcButton.Height()-7; DeferWindowPos(hDwp,m_btSound,NULL,nBeginPos,nYPosButton,rcButton.Width(),rcButton.Height(),uFlags); DeferWindowPos(hDwp,m_btLookOn,NULL,nBeginPos+nButtonSpace+rcButton.Width(),nYPosButton,rcButton.Width(),rcButton.Height(),uFlags); DeferWindowPos(hDwp,m_btGameRule,NULL,nBeginPos+nButtonSpace*2+rcButton.Width()*2,nYPosButton,rcButton.Width(),rcButton.Height(),uFlags); DeferWindowPos(hDwp,m_btGameOption,NULL,nBeginPos+nButtonSpace*3+rcButton.Width()*3,nYPosButton,rcButton.Width(),rcButton.Height(),uFlags); EndDeferWindowPos(hDwp); //重画界面 Invalidate(FALSE); UpdateWindow(); return; }
void ViewFilesDialog::ShiftControls(int deltaX, int deltaY) { HDWP hdwp; /* * Use deferred reposn so that they don't end up drawing on top of each * other and getting all weird. * * IMPORTANT: the DeferWindowPos stuff changes the tab order of the * items in the window. The controls must be added in the reverse * order in which they appear in the window. */ hdwp = BeginDeferWindowPos(15); hdwp = MoveControl(hdwp, this, AFX_IDW_SIZE_BOX, deltaX, deltaY); hdwp = MoveControl(hdwp, this, IDHELP, deltaX, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_FONT, deltaX, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_PRINT, deltaX, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_FIND, deltaX, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_FMT_RAW, 0, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_FMT_HEX, 0, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_FMT_BEST, 0, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_PREV, 0, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_NEXT, 0, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_CMMT, 0, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_RSRC, 0, deltaY); hdwp = MoveControl(hdwp, this, IDC_FVIEW_DATA, 0, deltaY); hdwp = MoveStretchControl(hdwp, this, IDC_FVIEW_FORMATSEL, 0, deltaY, deltaX, 0); hdwp = StretchControl(hdwp, this, IDC_FVIEW_EDITBOX, deltaX, deltaY); hdwp = MoveControl(hdwp, this, IDOK, deltaX, deltaY); if (!EndDeferWindowPos(hdwp)) { LOGI("EndDeferWindowPos failed"); } /* * Work around buggy CRichEdit controls. The inner edit area is only * resized when the box is shrunk, not when it's expanded, and the * results are inconsistent between Win98 and Win2K. * * Set the internal size equal to the size of the entire edit box. * This should be large enough to make everything work right, but small * enough to avoid funky scrolling behavior. (If you want to set this * more precisely, don't forget that scroll bars are not part of the * edit control client area, and their sizes must be factored in.) */ CRect rect; CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX); ASSERT(pEdit != NULL); //pEdit->GetClientRect(&rect); pEdit->GetWindowRect(&rect); //GetClientRect(&rect); rect.left = 2; rect.top = 2; pEdit->SetRect(&rect); }
void CNetworkMonitorBox::OnSize(UINT nType, int cx, int cy) { CTaskBox::OnSize( nType, cx, cy ); HDWP hDWP = BeginDeferWindowPos( 2 ); DeferWindowPos( hDWP, m_wndStart, NULL, BOX_MARGIN, 7, 55, 23, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndClock, NULL, BOX_MARGIN + 61, 7, 13 * 8, 23, SWP_NOZORDER ); EndDeferWindowPos( hDWP ); }
//--------------------------------------------------------------------------- void __fastcall TTVPMainForm::WMRearrangeModalWindows(TMessage &Msg) { if(TVPFullScreenedWindow != NULL && TVPGetModalWindowRearrangeInFullScreen()) { HDWP hdwp = BeginDeferWindowPos(1); hdwp = TVPShowModalAtTimer(hdwp); hdwp = TVPShowFontSelectFormTop(hdwp); hdwp = TVPShowHintWindowTop(hdwp); EndDeferWindowPos(hdwp); } }
void CHelperbarWindow::UpdateLayout() { RECT rc; GetClientRect(&rc); HDWP hdwp = BeginDeferWindowPos(2); hdwp = m_Toolbar.DeferWindowPos(hdwp, NULL, 0, 0, rc.right, m_ToolbarHeight, SWP_NOZORDER); hdwp = m_Console.DeferWindowPos(hdwp, NULL, 0, m_ToolbarHeight, rc.right, rc.bottom - m_ToolbarHeight, SWP_NOZORDER); EndDeferWindowPos(hdwp); }
void DialogBehaviorTreeEditor::OnSize( UINT nType, int cx, int cy ) { CRect rcClient; GetClientRect(rcClient); RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposDefault, 0, rcClient); RepositionBars(0, 0xffff, AFX_IDW_PANE_FIRST, reposQuery, rcClient, rcClient); HDWP hdwp = BeginDeferWindowPos(1); DeferWindowPos(hdwp, m_pView->GetSafeHwnd(), nullptr, rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), SWP_NOZORDER); EndDeferWindowPos(hdwp); }
VOID PhLayoutManagerLayout( _Inout_ PPH_LAYOUT_MANAGER Manager ) { ULONG i; Manager->LayoutNumber++; GetClientRect(Manager->RootItem.Handle, &Manager->RootItem.Rect); for (i = 0; i < Manager->List->Count; i++) { PPH_LAYOUT_ITEM item = (PPH_LAYOUT_ITEM)Manager->List->Items[i]; PhpLayoutItemLayout(Manager, item); } for (i = 0; i < Manager->List->Count; i++) { PPH_LAYOUT_ITEM item = (PPH_LAYOUT_ITEM)Manager->List->Items[i]; if (item->DeferHandle) { EndDeferWindowPos(item->DeferHandle); item->DeferHandle = NULL; } if (item->Anchor & PH_LAYOUT_FORCE_INVALIDATE) { InvalidateRect(item->Handle, NULL, FALSE); } } if (Manager->RootItem.DeferHandle) { EndDeferWindowPos(Manager->RootItem.DeferHandle); Manager->RootItem.DeferHandle = NULL; } }
void QCefWebView::ResizeBrowser(const QSize& size) { if (qcef_client_handler.get() && qcef_client_handler->GetBrowser()) { CefWindowHandle hwnd = qcef_client_handler->GetBrowser()->GetHost()->GetWindowHandle(); if (hwnd) { HDWP hdwp = BeginDeferWindowPos(1); hdwp = DeferWindowPos(hdwp, hwnd, NULL, 0, 0, size.width(), size.height(), SWP_NOZORDER); EndDeferWindowPos(hdwp); } } }
void CDlgResizer::DoResize(int width, int height) { UpdateGripPos(); if (m_controls.empty()) return; InvalidateRect(m_hDlg, NULL, true); HDWP hdwp = BeginDeferWindowPos((int)m_controls.size()); for (size_t i=0; i<m_controls.size(); ++i) { RECT newpos = m_controls[i].origSize; switch (m_controls[i].resizeType) { case RESIZER_TOPLEFT: break; // do nothing - the original position is fine case RESIZER_TOPRIGHT: newpos.left += (width - m_dlgRect.right); newpos.right += (width - m_dlgRect.right); break; case RESIZER_TOPLEFTRIGHT: newpos.right += (width - m_dlgRect.right); break; case RESIZER_TOPLEFTBOTTOMRIGHT: newpos.right += (width - m_dlgRect.right); newpos.bottom += (height - m_dlgRect.bottom); break; case RESIZER_BOTTOMLEFT: newpos.top += (height - m_dlgRect.bottom); newpos.bottom += (height - m_dlgRect.bottom); break; case RESIZER_BOTTOMRIGHT: newpos.top += (height - m_dlgRect.bottom); newpos.bottom += (height - m_dlgRect.bottom); newpos.left += (width - m_dlgRect.right); newpos.right += (width - m_dlgRect.right); break; case RESIZER_BOTTOMLEFTRIGHT: newpos.top += (height - m_dlgRect.bottom); newpos.bottom += (height - m_dlgRect.bottom); newpos.right += (width - m_dlgRect.right); break; } hdwp = DeferWindowPos(hdwp, m_controls[i].hWnd, NULL, newpos.left, newpos.top, newpos.right-newpos.left, newpos.bottom-newpos.top, SWP_NOZORDER); } EndDeferWindowPos(hdwp); UpdateGripPos(); }
static void sResize(int widthClient, int heightClient) { ::SendMessage(gHwndToolbar, TB_AUTOSIZE, (WPARAM)0, (LPARAM)0); ::SendMessage(gHwndStatusbar, WM_SIZE, (WPARAM)0, (LPARAM)0); RECT rcClient; ::SetRect(&rcClient, 0, 0, widthClient, heightClient); RECT rcWinScintilla; sGetRectEditor(&rcClient, &rcWinScintilla); HDWP hdwp; hdwp = BeginDeferWindowPos(1); DeferWindowPos(hdwp, gEditor.handle, HWND_TOP, rcWinScintilla.left, rcWinScintilla.top, rcWinScintilla.right - rcWinScintilla.left, rcWinScintilla.bottom - rcWinScintilla.top, (UINT)0); EndDeferWindowPos(hdwp); }
void CChildWnd::SizeListAndBar(CWnd* pList, CWnd* pBar) { CRect rc; GetClientRect( &rc ); rc.bottom -= Settings.Skin.ToolbarHeight; HDWP hPos = BeginDeferWindowPos( 2 ); DeferWindowPos( hPos, pList->GetSafeHwnd(), NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); DeferWindowPos( hPos, pBar->GetSafeHwnd(), NULL, rc.left, rc.bottom, rc.Width(), Settings.Skin.ToolbarHeight, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); EndDeferWindowPos( hPos ); }
VOID OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam) { /* Size status bar */ m_StatusBar->SendMessage(WM_SIZE, 0, 0); /* Size tool bar */ m_Toolbar->AutoSize(); RECT r = { 0, 0, LOWORD(lParam), HIWORD(lParam) }; HDWP hdwp = NULL; int count = m_ClientPanel->CountSizableChildren(); hdwp = BeginDeferWindowPos(count); hdwp = m_ClientPanel->OnParentSize(r, hdwp); EndDeferWindowPos(hdwp); // TODO: Sub-layouts for children of children count = m_SearchBar->CountSizableChildren(); hdwp = BeginDeferWindowPos(count); hdwp = m_SearchBar->OnParentSize(r, hdwp); EndDeferWindowPos(hdwp); }
void CNetworkTaskBox::OnSize(UINT nType, int cx, int cy) { CTaskBox::OnSize( nType, cx, cy ); HDWP hDWP = BeginDeferWindowPos( 2 ); DeferWindowPos( hDWP, m_wndChan, NULL, BOX_MARGIN, 27, cx - BOX_MARGIN * 2, 80, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndPlay, NULL, BOX_MARGIN, 80, cx - BOX_MARGIN * 2 - 80, 80, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndStart, NULL, cx - 80, 79, 72, 24, SWP_SHOWWINDOW|SWP_NOZORDER ); EndDeferWindowPos( hDWP ); }
/** * * Calls EndDeferWindowPos. * * @param Nil * @return bool - Returns execution status. * @exception Nil * @see Begin * @since 1.0 */ bool DeferWindowPosMgr::End() { BOOL bResult = FALSE; if( m_hdwp ) { bResult = EndDeferWindowPos( m_hdwp ); m_hdwp = 0; } // If redraw is enabled then enable drawing. IsRedrawEnabled() && m_hRedrawWindow && ::SendMessage( m_hRedrawWindow, WM_SETREDRAW, TRUE, 0 ); // Return status return bResult != FALSE; }// End
void RingDockSite::AdjustChildrenH(int nEdge) { LPRINGBARLINEINFO lpbarinfo = m_First,saveline; HDWP hdwp = BeginDeferWindowPos(10); int height = 0; if(m_State == TBS_FLAG_DOCKTOP) { height = 1; saveline = NULL; } else saveline = lpbarinfo; while(lpbarinfo) { if(saveline) { if(IsSizeBarInLine(saveline) && saveline->isVisible) { OffsetRect(&saveline->m_SplitRc,0,height - saveline->m_SplitRc.top); height += m_SplitterSize; } saveline = saveline->m_nextline; } else saveline = lpbarinfo; lpbarinfo->m_pos = height; hdwp = BarLineResizeH(hdwp,lpbarinfo,nEdge);//AdjustBarLineH(hdwp,nEdge,lpbarinfo,NULL); if(lpbarinfo->isVisible) height += lpbarinfo->m_maxSize; lpbarinfo = lpbarinfo->m_nextline; } if(IsSizeBarInLine(saveline) && saveline->isVisible) { OffsetRect(&saveline->m_SplitRc,0,height - saveline->m_SplitRc.top); height += m_SplitterSize; } if(hdwp) EndDeferWindowPos(hdwp); if(m_State == TBS_FLAG_DOCKTOP) m_rcPos.bottom = m_rcPos.top + height; else m_rcPos.top = m_rcPos.bottom - height; }
void CScheduleTableCfgDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); int nXPos = cx - m_DefaultSize.cx; int nYPos = cy - m_DefaultSize.cy; HDWP hDefer = NULL; hDefer = vUpdateWindowPosition(nXPos, nYPos); if (hDefer != NULL) { EndDeferWindowPos(hDefer); } vAdjustColumns(); }
//调整函数 void CUserInfoView::RectifyControl(int nWidth, int nHeight) { //调整位置 HDWP hDwp = BeginDeferWindowPos(20); UINT uFlags = SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER; CRect rcButton; m_btExchange.GetWindowRect(rcButton); int nBtPhotoPosX = PHOTO_FRAME_EXCURSION_X + (PHOTO_FRAME_WIDTH-rcButton.Width()) / 2; DeferWindowPos(hDwp, m_btExchange, NULL, 10, nHeight- rcButton.Height() - 5, 0, 0, uFlags); EndDeferWindowPos(hDwp); return; }
void threaded_process_v2_t::on_size(t_size cx, t_size cy) { RedrawWindow(get_wnd(), NULL, NULL, RDW_INVALIDATE); HDWP dwp = BeginDeferWindowPos(2); t_size y_progress = 11; if (m_flags & flag_show_text) y_progress += 7 + m_titlefont_height; { insync(m_sync); if (m_detail_entries.get_count()) y_progress += m_textfont_height*m_detail_entries.get_count() + 5; } dwp = DeferWindowPos(dwp, m_wnd_progress, NULL, 11 * 2, y_progress, cx - 11 * 2 - 11 * 2, 15, SWP_NOZORDER); if (m_wnd_button) dwp = DeferWindowPos(dwp, m_wnd_button, NULL, cx - 11 * 2 - 73, y_progress + 15 + 11 + 11, 73, m_textfont_height + 10, SWP_NOZORDER); EndDeferWindowPos(dwp); }
//位置消息 VOID CControlWnd::OnSize(UINT nType, INT cx, INT cy) { __super::OnSize(nType, cx, cy); //移动控件 HDWP hDwp=BeginDeferWindowPos(32); const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS|SWP_NOSIZE; //调整控件 DeferWindowPos(hDwp,m_btMaxScore,NULL,cx-28,4,0,0,uFlags); DeferWindowPos(hDwp,m_btLessScore,NULL,cx-28,26,0,0,uFlags); //结束移动 EndDeferWindowPos(hDwp); return; }
void CSyncDirSet::SetControlPos(int cx, int cy) { const UINT uFlags = SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOCOPYBITS | SWP_NOSIZE; LockWindowUpdate(); HDWP hDwp = BeginDeferWindowPos(32); CRect rcButton; m_btClose.GetWindowRect(&rcButton); DeferWindowPos(hDwp, m_btClose, NULL, cx - rcButton.Width() - 2, 0, 0, 0, uFlags); EndDeferWindowPos(hDwp); Invalidate(FALSE); UpdateWindow(); UnlockWindowUpdate(); }
static VOID sMoveButtons ( HWND hwnd, WORD wXsize, WORD wYsize) { HDWP hdwp; INT iButtonWidth, iButtonHeight; RECT rc; GetWindowRect (GetDlgItem (hwnd, IDOK), &rc); iButtonWidth = rc.right - rc.left; iButtonHeight = rc.bottom - rc.top; hdwp = BeginDeferWindowPos (4); // position the "cancel" button DeferWindowPos (hdwp, GetDlgItem (hwnd, IDCANCEL), NULL, wXsize - HOR_OFFSET - iButtonWidth, wYsize - BOTTOM_BUTTON_OFFSET - iButtonHeight, 0, 0, SWP_NOSIZE|SWP_NOZORDER); // position the "OK" button DeferWindowPos (hdwp, GetDlgItem (hwnd, IDOK), NULL, wXsize - HOR_OFFSET - BUTTON_SPACING - 2*iButtonWidth, wYsize - BOTTOM_BUTTON_OFFSET - iButtonHeight, 0, 0, SWP_NOSIZE|SWP_NOZORDER); // position the "unselectall" button DeferWindowPos (hdwp, GetDlgItem (hwnd, IDC_UNSELECTALL), NULL, wXsize - HOR_OFFSET - 2*BUTTON_SPACING - 3*iButtonWidth, wYsize - BOTTOM_BUTTON_OFFSET - iButtonHeight, 0, 0, SWP_NOSIZE|SWP_NOZORDER); // position the "selectall" button DeferWindowPos (hdwp, GetDlgItem (hwnd, IDC_SELECTALL), NULL, wXsize - HOR_OFFSET - 3*BUTTON_SPACING - 4*iButtonWidth, wYsize - BOTTOM_BUTTON_OFFSET - iButtonHeight, 0, 0, SWP_NOSIZE|SWP_NOZORDER); EndDeferWindowPos(hdwp); }
void dialog_resize_helper::on_wm_size() { if (parent) { unsigned count = m_table.get_size(); if (sizegrip != 0) count++; HDWP hWinPosInfo = BeginDeferWindowPos(count); for(unsigned n=0;n<m_table.get_size();n++) { param & e = m_table[n]; const RECT & orig_rect = rects[n]; RECT cur_client; GetClientRect(parent,&cur_client); HWND wnd = GetDlgItem(parent,e.id); if (wnd != NULL) { unsigned dest_x = orig_rect.left, dest_y = orig_rect.top, dest_cx = orig_rect.right - orig_rect.left, dest_cy = orig_rect.bottom - orig_rect.top; int delta_x = cur_client.right - orig_client.right, delta_y = cur_client.bottom - orig_client.bottom; if (e.flags & X_MOVE) dest_x += delta_x; else if (e.flags & X_SIZE) dest_cx += delta_x; if (e.flags & Y_MOVE) dest_y += delta_y; else if (e.flags & Y_SIZE) dest_cy += delta_y; DeferWindowPos(hWinPosInfo, wnd,0,dest_x,dest_y,dest_cx,dest_cy,SWP_NOZORDER); } } if (sizegrip != 0) { RECT rc, rc_grip; GetClientRect(parent, &rc); GetWindowRect(sizegrip, &rc_grip); DeferWindowPos(hWinPosInfo, sizegrip, NULL, rc.right - (rc_grip.right - rc_grip.left), rc.bottom - (rc_grip.bottom - rc_grip.top), 0, 0, SWP_NOZORDER | SWP_NOSIZE); } EndDeferWindowPos(hWinPosInfo); //RedrawWindow(parent,0,0,RDW_INVALIDATE); } }
void BrowserWindow::OnSize() { if (cefBrowser_) { HWND browserHandle = cefBrowser_->GetHost()->GetWindowHandle(); _ASSERT(browserHandle); RECT rect; GetClientRect(windowHandle_, &rect); HDWP hdwp = BeginDeferWindowPos(2); hdwp = DeferWindowPos(hdwp, browserHandle, NULL, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); EndDeferWindowPos(hdwp); } else { LOG_DEBUG << "BrowserWindow::OnSize(): " "CefBrowser object not yet created"; } }