//隐藏列表按钮 void CGameFrameDlg::OnBnClickedHideList() { CString strFile,strTemp; CTime tmCur = CTime::GetCurrentTime(); CString strTime = tmCur.Format("%m%d"); strFile.Format("log\\%sOnBnClickedHideList.log",strTime); strTemp.Format("%s", "OnBnClickedHideList()"); WriteLog(strFile, strTemp); static bool bHideList=true; int cx,cy; CRect rect; GetClientRect(rect); cx=rect.Width(); cy=rect.Height(); if(bHideList) { if (m_VorSplitter.GetSafeHwnd()) { UINT uSplitPos=cx-12; // SafeMoveWindow(&m_VorSplitter,uSplitPos,GetTitleHight(),SPLIT_WIDE,cy-GetTitleHight()); HDWP hDwp=BeginDeferWindowPos(32); DeferWindowPos(hDwp,m_VorSplitter,NULL,uSplitPos, 0,SPLIT_WIDE,cy, uFlags); EndDeferWindowPos(hDwp); RectifyControl(cx,cy); strTemp.Format("bHideList cx=%d,cy=%d", cx,cy); WriteLog(strFile, strTemp); // FixControlStation(cx,cy); } // m_BtExpression.ShowWindow(SW_HIDE); // m_BtSend.ShowWindow(SW_HIDE); } else { if (m_VorSplitter.GetSafeHwnd()) { //UINT uSplitPos=__max(cx*2/3-SPLIT_WIDE,350); //UINT uSplitPos=__max(cx*17/24-SPLIT_WIDE,350); UINT uSplitPos = cx - INFO_WIDTH - BUTTON_WIDE - 1; // SafeMoveWindow(&m_VorSplitter,uSplitPos,GetTitleHight(),SPLIT_WIDE,cy-GetTitleHight()); HDWP hDwp=BeginDeferWindowPos(32); DeferWindowPos(hDwp,m_VorSplitter,NULL,uSplitPos,0,SPLIT_WIDE,cy, uFlags); EndDeferWindowPos(hDwp); m_VorSplitter.InitSplitBar(cx*3/5,cx-250,false); // FixControlStation(cx,cy); RectifyControl(cx,cy); strTemp.Format("cx=%d,cy=%d", cx,cy); WriteLog(strFile, strTemp); } // m_BtExpression.ShowWindow(SW_SHOW); // m_BtSend.ShowWindow(SW_SHOW); } bHideList=!bHideList; return; }
void SPLASH::Show() { //get size of hSplashWnd (width and height) int x,y; int pwidth,pheight; int tx,ty; HDWP windefer; RECT rect,prect; GetClientRect(hSplashWnd,&rect); x=rect.right;y=rect.bottom; //get parent screen coordinates GetWindowRect(this->hParentWindow,&prect); //center splash window on parent window pwidth=prect.right-prect.left; pheight=prect.bottom - prect.top; tx=(pwidth/2) - (x/2); ty=(pheight/2) - (y/2); tx+=prect.left; ty+=prect.top; windefer=BeginDeferWindowPos(1); DeferWindowPos(windefer,hSplashWnd,HWND_NOTOPMOST,tx,ty,50,50,SWP_NOSIZE|SWP_SHOWWINDOW|SWP_NOZORDER); EndDeferWindowPos(windefer); ShowWindow(hSplashWnd,SW_SHOWNORMAL); UpdateWindow(hSplashWnd); this->SHOWING = TRUE; }
void CChatWnd::OnSize(UINT nType, int cx, int cy) { if ( nType != 1982 ) CPanelWnd::OnSize( nType, cx, cy ); CRect rc; GetClientRect( &rc ); if ( rc.Width() < m_nUsersSize + SPLIT_SIZE ) { m_nUsersSize = max( 0, rc.Width() - SPLIT_SIZE ); } HDWP hDWP = BeginDeferWindowPos( 4 ); DeferWindowPos( hDWP, m_wndView, NULL, rc.left, rc.top, rc.Width() - m_nUsersSize - SPLIT_SIZE, rc.Height() - TOOLBAR_HEIGHT - EDIT_HEIGHT, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndUsers, NULL, rc.left + rc.Width() - m_nUsersSize, rc.top, m_nUsersSize, rc.Height() - TOOLBAR_HEIGHT - EDIT_HEIGHT, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndToolBar, NULL, rc.left, rc.bottom - TOOLBAR_HEIGHT - EDIT_HEIGHT, rc.Width(), TOOLBAR_HEIGHT, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndEdit, NULL, rc.left, rc.bottom - EDIT_HEIGHT, rc.Width(), EDIT_HEIGHT, SWP_NOZORDER ); EndDeferWindowPos( hDWP ); m_wndUsers.SetColumnWidth( 0, m_nUsersSize - GetSystemMetrics( SM_CXVSCROLL ) ); }
void CSearchAdvancedBox::OnSize(UINT nType, int cx, int cy) { CTaskBox::OnSize( nType, cx, cy ); HDWP hDWP = BeginDeferWindowPos( 3 ); if ( m_wndCheckBoxG2.m_hWnd != NULL ) DeferWindowPos( hDWP, m_wndCheckBoxG2, NULL, BOX_MARGIN + 21, 28, ( cx - BOX_MARGIN * 3 ) / 2 - 20, 14, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); if ( m_wndCheckBoxG1.m_hWnd != NULL ) DeferWindowPos( hDWP, m_wndCheckBoxG1, NULL, BOX_MARGIN + 21, 48, ( cx - BOX_MARGIN * 3 ) / 2 - 20, 14, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); if ( m_wndCheckBoxED2K.m_hWnd != NULL ) DeferWindowPos( hDWP, m_wndCheckBoxED2K, NULL, ( cx / 2 ) + BOX_MARGIN / 2 + 26, 28, ( cx - BOX_MARGIN * 3 ) / 2 - 20, 14, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); if ( m_wndCheckBoxDC.m_hWnd != NULL ) DeferWindowPos( hDWP, m_wndCheckBoxDC, NULL, ( cx / 2 ) + BOX_MARGIN / 2 + 26, 48, ( cx - BOX_MARGIN * 3 ) / 2 - 20, 14, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); if ( m_wndSizeMin.m_hWnd != NULL ) { int width = ( cx - BOX_MARGIN * 6 ) / 2; DeferWindowPos( hDWP, m_wndSizeMin, NULL, BOX_MARGIN, 81, width, 219, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndSizeMax, NULL, cx - BOX_MARGIN - width, 81, width, 219, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndSizeMinMax, NULL, BOX_MARGIN + width, 81 + 2, BOX_MARGIN * 4, 18, SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOZORDER ); } EndDeferWindowPos( hDWP ); }
void ipod_browse_photo_dialog::on_size (HWND wnd, unsigned width, unsigned height) { HWND wnd_close = GetDlgItem(wnd, IDCANCEL); HWND wnd_next = GetDlgItem(wnd, IDC_NEXT); HWND wnd_last = GetDlgItem(wnd, IDC_LAST); HWND wnd_prev = GetDlgItem(wnd, IDC_PREVIOUS); HWND wnd_nextf = GetDlgItem(wnd, IDC_NEXT_FORMAT); HWND wnd_prevf = GetDlgItem(wnd, IDC_PREVIOUS_FORMAT); HDWP dwp = BeginDeferWindowPos(6); RECT rc_close, rc_next, rc_next_format, rc_prev, rc_prev_format, rc_last; GetWindowRect(wnd_close, &rc_close); GetRelativeRect(wnd_next, wnd, &rc_next); GetRelativeRect(wnd_last, wnd, &rc_last); GetRelativeRect(wnd_nextf, wnd, &rc_next_format); GetRelativeRect(wnd_prev, wnd, &rc_prev); GetRelativeRect(wnd_prevf, wnd, &rc_prev_format); unsigned cy_close = rc_close.bottom - rc_close.top; unsigned cx_close = rc_close.right - rc_close.left; dwp = DeferWindowPos(dwp, m_viewer.get_wnd(), NULL, 0, 0, width, height-cy_close-2, SWP_NOZORDER); dwp = DeferWindowPos(dwp, wnd_close, NULL, width-cx_close, height-cy_close, cx_close, cy_close, SWP_NOZORDER|SWP_NOSIZE); int cx = width-cx_close-2-rc_next.right+rc_next.left; dwp = DeferWindowPos(dwp, wnd_last, NULL, cx, height-cy_close, 0, 0, SWP_NOZORDER|SWP_NOSIZE); dwp = DeferWindowPos(dwp, wnd_next, NULL, cx -= (rc_last.right-rc_last.left +2), height-cy_close, 0, 0, SWP_NOZORDER|SWP_NOSIZE); dwp = DeferWindowPos(dwp, wnd_prev, NULL, cx -= (rc_prev.right-rc_prev.left +2), height-cy_close, 0, 0, SWP_NOZORDER|SWP_NOSIZE); dwp = DeferWindowPos(dwp, wnd_nextf, NULL, cx -= (rc_next_format.right-rc_next_format.left + 2), height-cy_close,0, 0, SWP_NOZORDER|SWP_NOSIZE); dwp = DeferWindowPos(dwp, wnd_prevf, NULL, cx -= (rc_prev_format.right-rc_prev_format.left + 2), height-cy_close, 0, 0, SWP_NOZORDER|SWP_NOSIZE); EndDeferWindowPos(dwp); }
void CImportPatchDlg::DoSize(int delta) { this->RemoveAllAnchors(); auto hdwp = BeginDeferWindowPos(6); hdwp = CSplitterControl::ChangeRect(hdwp, GetDlgItem(IDC_LIST_PATCH), 0, 0, 0, delta); hdwp = CSplitterControl::ChangeRect(hdwp, GetDlgItem(IDC_AM_TAB), 0, delta, 0, 0); hdwp = CSplitterControl::ChangeRect(hdwp, GetDlgItem(IDC_CHECK_3WAY), 0, delta, 0, delta); hdwp = CSplitterControl::ChangeRect(hdwp, GetDlgItem(IDC_CHECK_IGNORE_SPACE), 0, delta, 0, delta); hdwp = CSplitterControl::ChangeRect(hdwp, GetDlgItem(IDC_SIGN_OFF), 0, delta, 0, delta); hdwp = CSplitterControl::ChangeRect(hdwp, GetDlgItem(IDC_KEEP_CR), 0, delta, 0, delta); EndDeferWindowPos(hdwp); this->AddAmAnchor(); // adjust the minimum size of the dialog to prevent the resizing from // moving the list control too far down. CRect rcLogMsg; m_cList.GetClientRect(rcLogMsg); SetMinTrackSize(CSize(m_DlgOrigRect.Width(), m_DlgOrigRect.Height()-m_PatchListOrigRect.Height()+rcLogMsg.Height())); SetSplitterRange(); // m_CommitList.Invalidate(); // GetDlgItem(IDC_LOGMESSAGE)->Invalidate(); this->m_ctrlTabCtrl.Invalidate(); }
void childresize_resize(HWND hwndDlg, ChildWndResizeItem *list, int num) { RECT r; GetClientRect(hwndDlg,&r); int x; HDWP hdwp=BeginDeferWindowPos(num); for (x = 0; x < num; x ++) if (list[x].type&0xf0000) { RECT r2; if (list[x].type&0xF000) r2.left=r.right-list[x].rinfo.left; else r2.left=list[x].rinfo.left; if (list[x].type&0x0F00) r2.top=r.bottom-list[x].rinfo.top; else r2.top=list[x].rinfo.top; if (list[x].type&0x00F0) r2.right=r.right-list[x].rinfo.right; else r2.right=list[x].rinfo.right; if (list[x].type&0x000F) r2.bottom=r.bottom-list[x].rinfo.bottom; else r2.bottom=list[x].rinfo.bottom; HWND h=GetDlgItem(hwndDlg,list[x].id); DeferWindowPos(hdwp, h, NULL, r2.left,r2.top,r2.right-r2.left,r2.bottom-r2.top, SWP_NOZORDER|SWP_NOACTIVATE); }; EndDeferWindowPos(hdwp); }
static void LayoutTransfers(HWND hwnd, struct TFtPageData *dat) { int top = 0; RECT rc; GetClientRect(hwnd, &rc); dat->scrollPos = GetScrollPos(hwnd, SB_VERT); dat->height = rc.bottom - rc.top; if (dat->wnds->realCount) { HDWP hdwp = BeginDeferWindowPos(dat->wnds->realCount); top -= dat->scrollPos; for (int i = 0; i < dat->wnds->realCount; ++i) { int height = dat->wnds->items[i]->rc.bottom - dat->wnds->items[i]->rc.top; hdwp = DeferWindowPos(hdwp, dat->wnds->items[i]->hwnd, NULL, 0, top, rc.right, height, SWP_NOZORDER); top += height; } top += dat->scrollPos; EndDeferWindowPos(hdwp); } dat->dataHeight = top; SCROLLINFO si = { 0 }; si.cbSize = sizeof(si); si.fMask = SIF_DISABLENOSCROLL | SIF_PAGE | SIF_RANGE; si.nPage = dat->height; si.nMin = 0; si.nMax = dat->dataHeight; SetScrollInfo(hwnd, SB_VERT, &si, TRUE); }
//调整控件 VOID CWndUserInfoCtrl::RectifyControl(INT nWidth, INT nHeight) { //设置区域 m_rcUnderWrite.SetRect(127,52,nWidth-13,72); //变量定义 HDWP hDwp=BeginDeferWindowPos(64); UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER|SWP_NOSIZE; //按钮大小 CRect rcButton; m_btUserInfo1.GetWindowRect(&rcButton); //间隔定义 UINT nSpace=14; UINT nStartPos=18; //调整按钮 DeferWindowPos(hDwp,m_btUserInfoSet,NULL,69,15,0,0,uFlags); DeferWindowPos(hDwp,m_btUserInfo1,NULL,nStartPos,nHeight-rcButton.Height()-9,0,0,uFlags); DeferWindowPos(hDwp,m_btUserInfo2,NULL,nStartPos+rcButton.Width()+nSpace,nHeight-rcButton.Height()-9,0,0,uFlags); DeferWindowPos(hDwp,m_btUserInfo3,NULL,nStartPos+(rcButton.Width()+nSpace)*2,nHeight-rcButton.Height()-9,0,0,uFlags); //结束调整 EndDeferWindowPos(hDwp); return; }
void CPlayerWnd::OnSize(UINT nType, int cx, int cy) { if ( nType != SIZE_INTERNAL ) CChildWnd::OnSize( nType, cx, cy ); CRect rc; GetClientRect( &rc ); if ( rc.Width() < 32 || rc.Height() < 32 ) return; HDWP hDWP = BeginDeferWindowPos( 3 ); DeferWindowPos( hDWP, wndPanel.GetSafeHwnd(), NULL, rc.left, rc.top, PANEL_WIDTH, rc.Height(), SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndHeaderBar.GetSafeHwnd(), NULL, rc.left + PANEL_WIDTH, rc.top, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndBottom.GetSafeHwnd(), NULL, rc.left + PANEL_WIDTH, rc.bottom - BAR_HEIGHT, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER ); EndDeferWindowPos( hDWP ); if ( ! m_bPlaying ) return; CRect rect( rc.left + PANEL_WIDTH, rc.top + BAR_HEIGHT, rc.right, rc.bottom - BAR_HEIGHT ); m_wndPlayer.PutIntoWindow( m_hWnd, rect ); }
void CMsgSignalSelect::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); int iXDelta = cx - m_szInitial.cx; int iYDelta = cy - m_szInitial.cy; HDWP hDefer = NULL; for (MovingChildren::iterator p = m_MovingChildren.begin(); p != m_MovingChildren.end(); ++p) { if (p->m_hWnd != NULL) { CRect rcNew(p->m_rcInitial); rcNew.OffsetRect(int(iXDelta * p->m_dXMoveFrac), int(iYDelta * p->m_dYMoveFrac)); rcNew.right += int(iXDelta * p->m_dXSizeFrac); rcNew.bottom += int(iYDelta * p->m_dYSizeFrac); if (hDefer == NULL) { hDefer = BeginDeferWindowPos(m_MovingChildren.size()); } UINT uFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER; if ((p->m_dXSizeFrac != 0.0) || (p->m_dYSizeFrac != 0.0)) { uFlags |= SWP_NOCOPYBITS; } DeferWindowPos(hDefer, p->m_hWnd, NULL, rcNew.left, rcNew.top, rcNew.Width(), rcNew.Height(), uFlags); } } if (hDefer != NULL) { EndDeferWindowPos(hDefer); } //if (m_hGripper != NULL) // ::ShowWindow(m_hGripper, (nType == SIZE_MAXIMIZED) ? SW_HIDE : SW_SHOW); }
void CBaseDialog::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); int iXDelta = cx - m_szInitial.cx; int iYDelta = cy - m_szInitial.cy; HDWP hDefer = NULL; for (MovingChildren::iterator p = m_MovingChildren.begin(); p != m_MovingChildren.end(); ++p) { if (p->m_hWnd != NULL) { CRect rcNew(p->m_rcInitial); rcNew.OffsetRect(int(iXDelta * p->m_dXMoveFrac), int(iYDelta * p->m_dYMoveFrac)); rcNew.right += int(iXDelta * p->m_dXSizeFrac); rcNew.bottom += int(iYDelta * p->m_dYSizeFrac); if (hDefer == NULL) hDefer = BeginDeferWindowPos(m_MovingChildren.size()); UINT uFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER; if ((p->m_dXSizeFrac != 0.0) || (p->m_dYSizeFrac != 0.0)) uFlags |= SWP_NOCOPYBITS; DeferWindowPos(hDefer, p->m_hWnd, NULL, rcNew.left, rcNew.top, rcNew.Width(), rcNew.Height(), uFlags); } } if (hDefer != NULL) EndDeferWindowPos(hDefer); }
//We must call in WM_SIZE event, hWnd will be the our window handle void SimpleCEFDLL_ResizeBrowser( HWND hWnd ) { //Get the CEF handle CefRefPtr<zSimpleCefHandler> simpleCefHandler; if( !g_App->GetCEFHandler( hWnd, simpleCefHandler ) ) return; if( !simpleCefHandler.get() ) return; if( !simpleCefHandler->GetBrowser().get() ) return; if( !simpleCefHandler->GetBrowser()->GetHost().get() ) return; CefWindowHandle hWndBrowser = simpleCefHandler->GetBrowser()->GetHost()->GetWindowHandle(); if( hWndBrowser ) { //Get the size of our window RECT rect; GetClientRect( hWnd, &rect ); //Set the size to the browser HDWP hdwp = BeginDeferWindowPos (1); hdwp = DeferWindowPos (hdwp, hWndBrowser, NULL,rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER); EndDeferWindowPos (hdwp); } }
void TFrameWindow::size() { RECT rt; HDWP hdwp; int n = 0, bottom_extra = 0; if (m_status) n++; if (m_client) n++; if (n==0) return; GetClientRect(m_hwnd,&rt); hdwp = BeginDeferWindowPos(n); if (m_status) { DeferWindowPos(hdwp,m_status,NULL,0,0, //??? rt.right - rt.left, 20, SWP_NOZORDER); bottom_extra = 20; } if (m_client) DeferWindowPos(hdwp,m_client->handle(),NULL,0,0, rt.right - rt.left, rt.bottom-rt.top - bottom_extra, SWP_NOZORDER | SWP_NOMOVE); EndDeferWindowPos(hdwp); }
void CBaseDialog::OnSize(UINT/* nType*/, int cx, int cy) { HRESULT hRes = S_OK; HDWP hdwp = NULL; WC_D(hdwp, BeginDeferWindowPos(1)); if (hdwp) { int iHeight = GetStatusHeight(); int iNewCY = cy - iHeight; RECT rcStatus = { 0 }; ::GetClientRect(m_hWnd, &rcStatus); if (rcStatus.bottom - rcStatus.top > iHeight) { rcStatus.top = rcStatus.bottom - iHeight; } // Tell the status bar it needs repainting ::InvalidateRect(m_hWnd, &rcStatus, false); if (m_lpFakeSplitter && m_lpFakeSplitter->m_hWnd) { DeferWindowPos(hdwp, m_lpFakeSplitter->m_hWnd, NULL, 0, 0, cx, iNewCY, SWP_NOZORDER); } WC_B(EndDeferWindowPos(hdwp)); } } // CBaseDialog::OnSize
void UpdateWindowSize(DialogData* pdd, const int cx, const int cy, HWND hwnd) { const int nDeltaX = cx - pdd->sizeClient.dx; const int nDeltaY = cy - pdd->sizeClient.dy; HDWP hdwp = BeginDeferWindowPos(pdd->nItemCount); for (int i = 0; i < pdd->nItemCount; i++) { const DialogSizerSizingItem* psd = pdd->psd + i; HWND hwndChild = GetDlgItem(hwnd, psd->uControlID); RectI rect = MapRectToWindow(WindowRect(hwndChild), HWND_DESKTOP, hwnd); // Adjust the window horizontally if (psd->uSizeInfo & DS_MoveX) rect.x += nDeltaX; // Adjust the window vertically if (psd->uSizeInfo & DS_MoveY) rect.y += nDeltaY; // Size the window horizontally if (psd->uSizeInfo & DS_SizeX) rect.dx += nDeltaX; // Size the window vertically if (psd->uSizeInfo & DS_SizeY) rect.dy += nDeltaY; DeferWindowPos(hdwp, hwndChild, nullptr, rect.x, rect.y, rect.dx, rect.dy, SWP_NOACTIVATE | SWP_NOZORDER); } EndDeferWindowPos(hdwp); pdd->sizeClient = SizeI(cx, cy); // If we have a sizing grip enabled then adjust it's position pdd->UpdateGripper(); }
void CEasySkinManager::OnSize( UINT nType, int cx, int cy ) { CEasySkinDialog::OnSize(nType, cx, cy); //移动准备 HDWP hDwp=BeginDeferWindowPos(64); UINT uFlags=SWP_NOACTIVATE|SWP_NOCOPYBITS|SWP_NOZORDER; if ( m_enWndStyle != en_Wnd_None ) { DeferWindowPos(hDwp,m_btClose,NULL,cx-41,0,0,0,uFlags|SWP_NOSIZE); if ( m_enWndStyle != en_Wnd_CloseBox ) { if( m_enWndStyle != en_Wnd_MinimizeBox ) DeferWindowPos(hDwp,m_btMax,NULL,cx-69,0,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_btMin,NULL,cx-69-(m_enWndStyle==en_Wnd_Normal?28:0),0,0,0,uFlags|SWP_NOSIZE); } } //结束调整 //LockWindowUpdate(); EndDeferWindowPos(hDwp); //UnlockWindowUpdate(); //设置圆角 CRgn rgn; rgn.CreateRoundRectRgn(0,0,cx,cy,4,4); SetWindowRgn(rgn,FALSE); //更新界面 Invalidate(FALSE); }
void mxTab_resizeChild (HWND hwnd) { TC_ITEM ti; int index = TabCtrl_GetCurSel (hwnd); if (index >= 0) { ti.mask = TCIF_PARAM; TabCtrl_GetItem (hwnd, index, &ti); mxWidget *widget = (mxWidget *) ti.lParam; if (widget) { RECT rc, rc2; GetWindowRect (hwnd, &rc); ScreenToClient (GetParent (hwnd), (LPPOINT) &rc.left); ScreenToClient (GetParent (hwnd), (LPPOINT) &rc.right); TabCtrl_GetItemRect (hwnd, index, &rc2); int ex = GetSystemMetrics (SM_CXEDGE); int ey = GetSystemMetrics (SM_CYEDGE); rc.top += (rc2.bottom - rc2.top) + 3 * ey; rc.left += 2 * ex; rc.right -= 2 * ex; rc.bottom -= 2 * ey; HDWP hdwp = BeginDeferWindowPos (2); DeferWindowPos (hdwp, hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); DeferWindowPos (hdwp, (HWND) widget->getHandle (), HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW); EndDeferWindowPos (hdwp); } } }
void CAutoSplitter::MoveControls(int dx, int dy) { HDWP hDWP=BeginDeferWindowPos(GetSize()); for (int i=0; i<GetSize(); i++) { CAutoSizeControl* pControl=GetAt(i); RECT rcControl; GetWindowRect(pControl->m_hWndControl, &rcControl); DWORD dwFlags=pControl->m_dwFlags; // Work out new rectangle if (dwFlags & ASF_TOP) rcControl.top+=dy; if (dwFlags & ASF_BOTTOM) rcControl.bottom+=dy; if (dwFlags & ASF_LEFT) rcControl.left+=dx; if (dwFlags & ASF_RIGHT) rcControl.right+=dx; ScreenToClient(m_hWndParent, (LPPOINT)&rcControl.left); ScreenToClient(m_hWndParent, (LPPOINT)&rcControl.right); hDWP=DeferWindowPos(hDWP, pControl->m_hWndControl, NULL, rcControl.left, rcControl.top, rcControl.right-rcControl.left, rcControl.bottom-rcControl.top, SWP_NOZORDER|SWP_NOACTIVATE); } EndDeferWindowPos(hDWP); }
void CMonitorWnd::OnSize(UINT nType, int cx, int cy) { if ( nType != SIZE_INTERNAL ) CChildWnd::OnSize( nType, cx, cy ); CRect rc; GetClientRect( &rc ); if ( rc.Width() < 32 || rc.Height() < 32 ) return; HDWP hDWP = BeginDeferWindowPos( 4 ); DeferWindowPos( hDWP, wndPanel.GetSafeHwnd(), NULL, rc.left, rc.top, PANEL_WIDTH, rc.Height(), SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndHeaderBar.GetSafeHwnd(), NULL, rc.left + PANEL_WIDTH, rc.top, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndChild.GetSafeHwnd(), NULL, rc.left + PANEL_WIDTH, rc.top + BAR_HEIGHT, rc.Width() - PANEL_WIDTH, rc.Height() - BAR_HEIGHT * 2, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndBottom.GetSafeHwnd(), NULL, rc.left + PANEL_WIDTH, rc.bottom - BAR_HEIGHT, rc.Width() - PANEL_WIDTH, BAR_HEIGHT, SWP_NOZORDER ); EndDeferWindowPos( hDWP ); }
//位置消息 void CPlazaViewItem::OnSize(UINT nType, int cx, int cy) { __super::OnSize(nType, cx, cy); //状态判断 if (m_bInitDialog==false) return; if ((cx==0)||(cy==0)) return; //变量定义 const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS; //移动控件 HDWP hDwp=BeginDeferWindowPos(32); DeferWindowPos(hDwp,m_pHtmlBrower->GetSafeHwnd(),NULL,m_ImageInfoWeb.nLBorder,m_ImageInfoWeb.nTBorder, cx-m_ImageInfoWeb.nLBorder-m_ImageInfoWeb.nRBorder,cy-m_ImageInfoWeb.nTBorder-m_ImageInfoWeb.nBBorder,uFlags); //导航按钮 CRect rcButton; m_WEB_BEFORE.GetWindowRect(&rcButton); DeferWindowPos(hDwp,m_WEB_BEFORE,NULL,10,3,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_WEB_NEXT,NULL,10+rcButton.Width(),3,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_WEB_BRUSH,NULL,10+rcButton.Width()*2,3,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_WEB_STOP,NULL,10+rcButton.Width()*3,3,0,0,uFlags|SWP_NOSIZE); DeferWindowPos(hDwp,m_WEB_HOME,NULL,10+rcButton.Width()*4,3,0,0,uFlags|SWP_NOSIZE); EndDeferWindowPos(hDwp); return; }
void CDialogResizeHelper::OnSize(UINT, CSize newSize) { if (m_thisWnd != NULL) { HDWP hWinPosInfo = BeginDeferWindowPos( m_table.get_size() + (m_sizeGrip != NULL ? 1 : 0) ); for(t_size n = 0; n < m_table.get_size(); ++n) { CRect rc; if (_EvalRect(n, newSize, rc)) { hWinPosInfo = DeferWindowPos(hWinPosInfo, m_thisWnd.GetDlgItem(m_table[n].id), 0, rc.left,rc.top,rc.Width(),rc.Height(),SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS); } } if (m_sizeGrip != NULL) { RECT rc, rc_grip; if (m_thisWnd.GetClientRect(&rc) && m_sizeGrip.GetWindowRect(&rc_grip)) { DWORD flags = SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS; if (IsZoomed(m_thisWnd)) flags |= SWP_HIDEWINDOW; else flags |= SWP_SHOWWINDOW; hWinPosInfo = DeferWindowPos(hWinPosInfo, m_sizeGrip, NULL, rc.right - (rc_grip.right - rc_grip.left), rc.bottom - (rc_grip.bottom - rc_grip.top), 0, 0, flags ); } } EndDeferWindowPos(hWinPosInfo); //RedrawWindow(m_thisWnd, NULL, NULL, RDW_UPDATENOW | RDW_ALLCHILDREN); } SetMsgHandled(FALSE); }
void CResizingDialog::OnSize(UINT nType,int cx,int cy) { INXRect rect; HDWP hdwp; std::vector<CItem>::iterator it; // call the base class CDialog::OnSize(nType,cx,cy); if(m_Items.size()) { // get the new size GetWindowRect(rect); // start deferring window pos hdwp=BeginDeferWindowPos(20); // children can resize themselves for(it=m_Items.begin();it!=m_Items.end();it++) it->OnSize(hdwp,m_rcDialog,rect,this); // do the deferred window position change EndDeferWindowPos(hdwp); } // remember new size m_rcDialog=rect; }
//调整界面 void CGameParrentDlg::RectifyControl(int nWidth, int nHeight) { //状态判断 if (m_bInitDialog==false) return; //改对话框要改 //变量定义 const int iXExc=0;//GetXExcursionPos(); const int iYExc=0;//GetYExcursionPos(); const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS; //锁定屏幕 LockWindowUpdate(); //移动控件 HDWP hDwp=BeginDeferWindowPos(3); DeferWindowPos(hDwp,m_pGameFrameView->GetSafeHwnd(),NULL,iXExc,iYExc,nWidth-2*iXExc,nHeight-iYExc,uFlags); EndDeferWindowPos(hDwp); //重画界面 Invalidate(FALSE); UpdateWindow(); //解除锁定 UnlockWindowUpdate(); return; }
void CInteractionAreaDialog::RepositionControls() { if (m_bIsInitialized) { CRect rcWin; GetWindowRect(&rcWin); CRect rcOK; m_btnOK.GetWindowRect(&rcOK); CRect rcCancel; m_btnCancel.GetWindowRect(&rcCancel); CRect rcBack; m_stBottom.GetWindowRect(&rcBack); CRect rcControl; rcControl = rcOK; rcControl.top = rcWin.bottom - m_iButtonVOffset - rcOK.Height(); rcControl.bottom = rcWin.bottom - m_iButtonVOffset; rcControl.left = rcOK.left; rcControl.right = rcOK.right; ScreenToClient(&rcControl); //m_btnOK.MoveWindow(&rcControl, TRUE); CRect rcControl1; rcControl1 = rcCancel; rcControl1.top = rcWin.bottom - m_iButtonVOffset - rcCancel.Height(); rcControl1.bottom = rcWin.bottom - m_iButtonVOffset; rcControl1.left = rcCancel.left; rcControl1.right = rcCancel.right; ScreenToClient(&rcControl1); //m_btnCancel.MoveWindow(&rcControl, TRUE); CRect rcControl2; rcControl2 = rcBack; rcControl2.top = rcWin.bottom - m_iBackVOffset - rcBack.Height(); rcControl2.bottom = rcWin.bottom - m_iBackVOffset; rcControl2.left = rcBack.left; rcControl2.right = rcBack.right; ScreenToClient(&rcControl2); //m_stBottom.MoveWindow(&rcControl, TRUE); HDWP hDefer = BeginDeferWindowPos(3); UINT uFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER; if(hDefer) DeferWindowPos(hDefer, m_btnOK.m_hWnd, NULL, rcControl.left, rcControl.top, rcControl.Width(), rcControl.Height(), uFlags); if(hDefer) DeferWindowPos(hDefer, m_btnCancel.m_hWnd, NULL, rcControl1.left, rcControl1.top, rcControl1.Width(), rcControl1.Height(), uFlags); if(hDefer) DeferWindowPos(hDefer, m_stBottom.m_hWnd, NULL, rcControl2.left, rcControl2.top, rcControl2.Width(), rcControl2.Height(), uFlags); EndDeferWindowPos(hDefer); InvalidateRect(&rcControl2); } }
//调整控件 void CGameClientView::RectifyGameView(int nWidth, int nHeight) { //位置变量 int nXPos=m_nXBorder+5; int nYPos=(nHeight-m_UserInfoSize.cy)/2-30; //用户数据 m_ptName[0].x=nXPos+18; m_ptName[0].y=nYPos+62; m_ptFace[0].x=nXPos+18; m_ptFace[0].y=nYPos+24; m_ptReady[0].x=nXPos+66; m_ptReady[0].y=nYPos+40; m_ptTimer[0].x=nXPos+65; m_ptTimer[0].y=nYPos+99; m_ChessFlagPoint[0].x=nXPos+85; m_ChessFlagPoint[0].y=nYPos+27; //用户数据 m_ptFace[1].x=nXPos+18; m_ptFace[1].y=nYPos+194; m_ptName[1].x=nXPos+18; m_ptName[1].y=nYPos+233; m_ptReady[1].x=nXPos+66; m_ptReady[1].y=nYPos+210; m_ptTimer[1].x=nXPos+65; m_ptTimer[1].y=nYPos+271; m_ChessFlagPoint[1].x=nXPos+85; m_ChessFlagPoint[1].y=nYPos+197; //调整棋盘 const CSize & BoradSize=m_ChessBorad.GetChessBoradSize(); nYPos=(nHeight-BoradSize.cy)/2+10; nXPos=m_nXBorder+m_UserInfoSize.cx+(nWidth-m_UserInfoSize.cx-BoradSize.cx-2*m_nXBorder)/2; if ((nXPos+BoradSize.cx+m_nXBorder)>nWidth) nXPos=nWidth-BoradSize.cx-m_nXBorder; m_ChessBorad.MoveWindow(nXPos,nYPos-10,BoradSize.cx,BoradSize.cy); //调整成绩 const CSize & ScoreSize=m_GameScoreWnd.GetGameScoreSize(); nXPos=m_nXBorder+m_UserInfoSize.cx+(nWidth-m_UserInfoSize.cx-ScoreSize.cx-2*m_nXBorder)/2; m_GameScoreWnd.MoveWindow(nXPos,m_nYBorder+5,ScoreSize.cx,ScoreSize.cy); //调整按钮 CRect rcButton; HDWP hDwp=BeginDeferWindowPos(6); m_btStart.GetWindowRect(&rcButton); nYPos=nHeight-m_nYBorder-m_ButtonBackSize.cy-30; nXPos=m_UserInfoSize.cx+(nWidth-m_UserInfoSize.cx-m_ButtonBackSize.cx)/2; const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS|SWP_NOSIZE; DeferWindowPos(hDwp,m_btStart,NULL,nXPos+25,nYPos+8,0,0,uFlags); DeferWindowPos(hDwp,m_btRegret,NULL,nXPos+rcButton.Width()+25,nYPos+8,0,0,uFlags); DeferWindowPos(hDwp,m_btPeace,NULL,nXPos+rcButton.Width()*2+25,nYPos+8,0,0,uFlags); DeferWindowPos(hDwp,m_btGiveUp,NULL,nXPos+rcButton.Width()*3+25,nYPos+8,0,0,uFlags); DeferWindowPos(hDwp,m_btPreserve,NULL,nXPos+rcButton.Width()*4+25,nYPos+8,0,0,uFlags); DeferWindowPos(hDwp,m_btStudy,NULL,nXPos+rcButton.Width()*5+25,nYPos+8,0,0,uFlags); EndDeferWindowPos(hDwp); return; }
static VOID CALLBACK MainWndResize(PVOID Context, WORD cx, WORD cy) { RECT rcClient = {0}; RECT rcStatus = {0}; HDWP dwp; PMAIN_WND_INFO Info = (PMAIN_WND_INFO)Context; /* Calculate the MDI client rectangle */ rcClient.right = cx; rcClient.bottom = cy; if (Info->hStatus != NULL) { GetWindowRect(Info->hStatus, &rcStatus); rcClient.bottom -= (rcStatus.bottom - rcStatus.top); } dwp = BeginDeferWindowPos(2); if (dwp != NULL) { /* Update the MDI client */ if (Info->hMdiClient != NULL) { dwp = DeferWindowPos(dwp, Info->hMdiClient, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top, SWP_NOZORDER); if (dwp == NULL) return; } /* Update the status bar */ if (Info->hStatus != NULL) { dwp = DeferWindowPos(dwp, Info->hStatus, NULL, 0, cy - (rcStatus.bottom - rcStatus.top), cx, rcStatus.bottom - rcStatus.top, SWP_NOZORDER); if (dwp == NULL) return; } EndDeferWindowPos(dwp); } }
//初始化函数 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_btPreserve.SetButtonImage(IDB_MANUAL_BT_PRESERVE,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()*8-40)/9; int nYPos=rcClient.Height()-rcButton.Height()-30; //移动按钮 HDWP hDwp=BeginDeferWindowPos(8); const UINT uFlags=SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS|SWP_NOSIZE; DeferWindowPos(hDwp,m_btOpen,NULL,20+nXButtonSpace,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btPreserve,NULL,20+nXButtonSpace*2+rcButton.Width(),nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btReLoad,NULL,20+nXButtonSpace*3+rcButton.Width()*2,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btFirst,NULL,20+nXButtonSpace*4+rcButton.Width()*3,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btBefore,NULL,20+nXButtonSpace*5+rcButton.Width()*4,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btNext,NULL,20+nXButtonSpace*6+rcButton.Width()*5,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btLast,NULL,20+nXButtonSpace*7+rcButton.Width()*6,nYPos,0,0,uFlags); DeferWindowPos(hDwp,m_btCancel,NULL,20+nXButtonSpace*8+rcButton.Width()*7,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 size_windows() { if (!/*g_minimised*/IsIconic(g_main_window) && !ui_initialising) { RECT rc_main_client; GetClientRect(g_main_window, &rc_main_client); HDWP dwp = BeginDeferWindowPos(7); if (dwp) { int status_height = 0; if (g_status) { //uSendMessage(g_status, WM_SETREDRAW, FALSE, 0); uSendMessage(g_status,WM_SIZE,0,0); RECT rc_status; GetWindowRect(g_status, &rc_status); status_height += rc_status.bottom-rc_status.top; //dwp = DeferWindowPos(dwp, g_status, 0, 0, rc_main_client.bottom-status_height, rc_main_client.right-rc_main_client.left, status_height, SWP_NOZORDER|SWP_NOREDRAW); } if (g_status_pane.get_wnd()) { int cy = g_status_pane.get_ideal_height(); RedrawWindow(g_status_pane.get_wnd(), 0, 0, RDW_INVALIDATE); dwp = DeferWindowPos(dwp, g_status_pane.get_wnd(), 0, 0, rc_main_client.bottom-status_height-cy, rc_main_client.right-rc_main_client.left, cy, SWP_NOZORDER); status_height += cy; } int rebar_height=0; if (g_rebar) { RECT rc_rebar; GetWindowRect(g_rebar, &rc_rebar); rebar_height = rc_rebar.bottom-rc_rebar.top; } if (g_layout_window.get_wnd()) dwp = DeferWindowPos(dwp, g_layout_window.get_wnd(), 0, 0, rebar_height, rc_main_client.right-rc_main_client.left, rc_main_client.bottom-rc_main_client.top-rebar_height-status_height, SWP_NOZORDER); if (g_rebar) { dwp = DeferWindowPos(dwp, g_rebar, 0, 0, 0, rc_main_client.right-rc_main_client.left, rebar_height, SWP_NOZORDER); } EndDeferWindowPos(dwp); if (g_status) { status_bar::set_part_sizes(status_bar::t_parts_none); } } } }
void CDialogResizeHelper::OnSize(UINT, CSize newSize) { if (m_thisWnd != NULL) { HDWP hWinPosInfo = BeginDeferWindowPos( m_table.get_size() + (m_sizeGrip != NULL ? 1 : 0) ); for(t_size n = 0; n < m_table.get_size(); ++n) { CRect rcOrig; const Param & e = m_table[n]; CWindow wndItem = m_thisWnd.GetDlgItem(e.id); if (m_origRects.query(e.id, rcOrig) && wndItem != NULL) { int dest_x = rcOrig.left, dest_y = rcOrig.top, dest_cx = rcOrig.Width(), dest_cy = rcOrig.Height(); int delta_x = newSize.cx - m_rcOrigClient.right, delta_y = newSize.cy - m_rcOrigClient.bottom; dest_x += pfc::rint32( e.snapLeft * delta_x ); dest_cx += pfc::rint32( (e.snapRight - e.snapLeft) * delta_x ); dest_y += pfc::rint32( e.snapTop * delta_y ); dest_cy += pfc::rint32( (e.snapBottom - e.snapTop) * delta_y ); DeferWindowPos(hWinPosInfo, wndItem, 0,dest_x,dest_y,dest_cx,dest_cy,SWP_NOZORDER); } } if (m_sizeGrip != NULL) { RECT rc, rc_grip; if (m_thisWnd.GetClientRect(&rc) && m_sizeGrip.GetWindowRect(&rc_grip)) { DeferWindowPos(hWinPosInfo, m_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); } SetMsgHandled(FALSE); }