// Message Handler void CChildView::OnLButtonDown( UINT nFlags, CPoint point) { // 실행 시간에 caption바 제거하기. static BOOL b = FALSE; b = !b; CWnd* pFrame = AfxGetMainWnd(); if ( b ) pFrame->ModifyStyle( WS_CAPTION, 0); // 제거할 style, 넣을 style else pFrame->ModifyStyle( 0, WS_CAPTION); //??? 될까 ? // style 바꾼경우 반드시 다시 윈도우를 그리게 해야 한다. pFrame->SetWindowPos( 0,0,0,0,0, // zorder, x, y, w, h SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DRAWFRAME); // caption bar에 그리기. //CWindowDC dc( this); // view 는 caption 이 없다. // CWindowDC dc( AfxGetMainWnd() ); // dc.TextOut( 0,0, "hello"); // caption bar에 그려질까 ? /* // Win32 Code를 사용한 그림그리기. HDC hdc = ::GetDC( this->m_hWnd ); ::Rectangle( hdc, point.x, point.y, point.x + 50, point.y + 50); ::ReleaseDC( this->m_hWnd, hdc); */ }
//***************************************************************************** void CBCGPFrameWnd::AdjustClientArea () { CWnd* pChildWnd = GetDlgItem (AFX_IDW_PANE_FIRST); if (pChildWnd != NULL) { CRect rectClientAreaBounds = m_dockManager.GetClientAreaBounds (); rectClientAreaBounds.left += m_rectBorder.left; rectClientAreaBounds.top += m_rectBorder.top; rectClientAreaBounds.right -= m_rectBorder.right; rectClientAreaBounds.bottom -= m_rectBorder.bottom; pChildWnd->CalcWindowRect (rectClientAreaBounds); if (!pChildWnd->IsKindOf (RUNTIME_CLASS (CSplitterWnd)) && !pChildWnd->IsKindOf (RUNTIME_CLASS (CFormView))) { pChildWnd->ModifyStyle (0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS); } else { pChildWnd->ModifyStyle (0, WS_CLIPSIBLINGS); } pChildWnd->SetWindowPos (&wndBottom, rectClientAreaBounds.left, rectClientAreaBounds.top, rectClientAreaBounds.Width (), rectClientAreaBounds.Height (), SWP_NOACTIVATE); } }
/*! * This function modifies a window to enable resizing functionality. * This affects the window style, size, system menu and appearance. * * @param lpCreateStruct Pointer to a @c CREATESTRUCT structure, usually * passed by the system to the window procedure in a @c WM_CREATE * or @c WM_NCCREATE * * @remarks The function is intended to be called only inside a @c WM_CREATE * or @c WM_NCCREATE message handler. */ void CResizableLayout::MakeResizable(LPCREATESTRUCT lpCreateStruct) { if (lpCreateStruct->style & WS_CHILD) return; CWnd* pWnd = GetResizableWnd(); #if (_WIN32_WINNT >= 0x0501 && !defined(RSZLIB_NO_XP_DOUBLE_BUFFER)) // enable double-buffering on supported platforms pWnd->ModifyStyleEx(0, WS_EX_COMPOSITED); #endif if (!(lpCreateStruct->style & WS_THICKFRAME)) { // set resizable style pWnd->ModifyStyle(DS_MODALFRAME, WS_THICKFRAME); // keep client area CRect rect(CPoint(lpCreateStruct->x, lpCreateStruct->y), CSize(lpCreateStruct->cx, lpCreateStruct->cy)); pWnd->SendMessage(WM_NCCALCSIZE, FALSE, (LPARAM)&rect); // adjust size to reflect new style ::AdjustWindowRectEx(&rect, pWnd->GetStyle(), ::IsMenu(pWnd->GetMenu()->GetSafeHmenu()), pWnd->GetExStyle()); pWnd->SetWindowPos(NULL, 0, 0, rect.Width(), rect.Height(), SWP_NOSENDCHANGING|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOREPOSITION); // update dimensions lpCreateStruct->cx = rect.Width(); lpCreateStruct->cy = rect.Height(); } }
void CDlgProcessSequence::DoDataExchange(CDataExchange* pDX) { if(!pDX->m_bSaveAndValidate) { if(!m_pSequence->isValidSequence(m_sValidMsg)) { CWnd *pWnd = GetDlgItem(IDOK); pWnd->ModifyStyle(NULL, WS_DISABLED); pWnd->Invalidate(); } else { CWnd *pWnd = GetDlgItem(IDOK); pWnd->ModifyStyle(WS_DISABLED, NULL); pWnd->Invalidate(); } } CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgProcessSequence) DDX_Control(pDX, IDC_Remove, m_btnRemove); DDX_Control(pDX, IDC_Properties, m_btnProperties); DDX_Control(pDX, IDC_InsertBefore, m_btnInsertBefore); DDX_Control(pDX, IDC_InsertAfter, m_btnInsertAfter); DDX_Control(pDX, IDC_ProcessList, m_processListCtrl); DDX_Text(pDX, IDC_ValidMsg, m_sValidMsg); //}}AFX_DATA_MAP if(pDX->m_bSaveAndValidate) { if(!m_pSequence->isValidSequence(m_sValidMsg)) { AfxMessageBox(m_sValidMsg); pDX->Fail(); } } }
BOOL CGrammarBuilderComplxConDlg::OnInitDialog() { CPropertyPage::OnInitDialog(); int nSourceText,nRowHeight; long lColor; BOOL b; CRect rect,rect1; CWnd* pWnd; IDispatch* pSourceFontDisp; nSourceText=m_pDoc->m_nSourceText; //determine if OT or NT pSourceFontDisp=m_pDoc->GetPointerToSourceLanguageFont(nSourceText); m_datatblComplexConcepts.GetColumnSet().GetItem(1).SetFont(pSourceFontDisp); lColor=m_pDoc->GetSourceBackgroundColor(1); m_datatblComplexConcepts.SetBackColor(lColor); nRowHeight=m_pDoc->GetSourceRowHeight(nSourceText); m_datatblComplexConcepts.GetRowSet().SetHeight((float)nRowHeight); m_cboSyntacticCategory.ResetContent(); m_cboSyntacticCategory.AddString(L"Nouns"); m_cboSyntacticCategory.AddString(L"Verbs"); m_cboSyntacticCategory.AddString(L"Ajectives"); m_cboSyntacticCategory.AddString(L"Adverbs"); m_cboSyntacticCategory.AddString(L"Adpositions"); m_cboSyntacticCategory.AddString(L"Conjunctions"); m_cboSyntacticCategory.AddString(L"Pronouns"); m_cboSyntacticCategory.AddString(L"Particles"); m_ncboSyntacticCategory=1; //init to verbs UpdateData(FALSE); //create popup to show examples rect1=CRect(1,1,2,2); b=m_recPopup.Create(ES_READONLY | ES_MULTILINE, rect1, this, 1); pWnd=&m_recPopup; pWnd->ModifyStyle(0,WS_BORDER); CHARFORMAT2 cf; cf.dwMask=CFM_FACE | CFM_BOLD; cf.dwEffects=!CFE_BOLD; wcscpy_s(cf.szFaceName,L"Arial"); m_recPopup.SetDefaultCharFormat(cf); // m_recPopup.SetBackgroundColor(FALSE,14745342); m_bPopupVisible=FALSE; m_nSyntacticCategory=2; LoadSyntacticCategory(); //load all the complex concepts in the current syncat CString T; T=m_pDoc->m_strTargetLanguageName; if (T!=L"English") AfxMessageBox(L"Right now the Complex Concept Expansion Rules only work when the target language is English. If you want to see these rules work, please switch to the English database."); else AfxMessageBox(L"Right now the only complex concepts that have expansion rules are BETRAY and FORGIVE."); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CXTPControlCustom::SetRect(CRect rcControl) { if (m_rcControl == rcControl && !(m_hwndControl && ::GetParent(m_hwndControl) != m_pParent->GetSafeHwnd())) return; m_rcControl = rcControl; CWnd* pControlWnd = CWnd::FromHandle(m_hwndControl); if (pControlWnd && pControlWnd->GetSafeHwnd() && ::IsWindow(pControlWnd->GetSafeHwnd())) { pControlWnd->SetParent(m_pParent); pControlWnd->ModifyStyle(WS_POPUP, WS_CHILD); rcControl.DeflateRect(m_rcBorders); pControlWnd->MoveWindow(rcControl); ShowHideChildControl(); } }
void CTDLFilterBar::SetFilterLabelAlignment(BOOL bLeft) { UINT nAlign = bLeft ? SS_LEFT : SS_RIGHT; int nLabel = NUMFILTERCTRLS; while (nLabel--) { UINT nLabelID = FILTERCTRLS[nLabel].nIDLabel; if (nLabelID) { CWnd* pLabel = GetDlgItem(nLabelID); pLabel->ModifyStyle(SS_TYPEMASK, nAlign); pLabel->Invalidate(); } } }
void CGuiWorkTab::SizeScroll() { SCROLLINFO sCrollInfo; ASSERT_VALID(this); if (!m_pArray.GetSize()) return; CGuiTab* ct = (CGuiTab*) m_pArray[m_iSelectTab]; CWnd* ViewAc = ct->pParent; memset(&sCrollInfo, 0, sizeof(SCROLLINFO)); sCrollInfo.cbSize = sizeof(SCROLLINFO); sCrollInfo.fMask = SIF_ALL; ViewAc->GetScrollInfo(SB_HORZ, &sCrollInfo); if (::IsWindow(m_scroll.GetSafeHwnd())) m_scroll.SetScrollInfo(&sCrollInfo); ViewAc->ShowScrollBar(SB_HORZ, FALSE); ViewAc->ModifyStyle(WS_HSCROLL, 0, SWP_DRAWFRAME); }
///////////////////////////////////////////////////////////////////////////// // CSettingsDialog::CreatePage(const PAGE_INFO *pInfo) // Description: Create the Window of the page specified by the page info. // Return value: TRUE if successful, or FALSE if failed // BOOL CSettingsDialog::CreatePage(const PAGE_INFO *pInfo) { BOOL bCode = FALSE; if (!pInfo || !pInfo->pWnd) return(FALSE); // If no page is specified, return NULL if (!::IsWindow(pInfo->pWnd->m_hWnd)) // If the window has not yet been created, { if (pInfo->pWnd->IsKindOf(RUNTIME_CLASS(CDialog))) // If the page indow is kind of dialog window { CDialog *pDlg = (CDialog*)pInfo->pWnd; bCode = pDlg->Create(pInfo->nID, this); pDlg->ModifyStyle(WS_CAPTION, 0); } else if (pInfo->pWnd->IsKindOf(RUNTIME_CLASS(CWnd))) // generic CWnd derived Window { CWnd *pWnd = (CWnd*)pInfo->pWnd; bCode = CreateWnd(pInfo->pWnd); // Create Window pWnd->ModifyStyle(WS_BORDER|WS_THICKFRAME, 0); // Remoce border and thick frame styles } } return(bCode); }
void CBCGPFileDialog::OnInitDone() { const int iBorderWidth = 20; const int iBorderHeight = 40; CWnd* pFD = GetParent(); ASSERT (pFD != NULL); CRect rectClient; pFD->GetClientRect (rectClient); int nNewDlgWidth = rectClient.Width () + iBorderWidth * 2 + m_iExtraWidth; if (m_pBmpLogo != NULL) { BITMAP bmp; m_pBmpLogo->GetBitmap (&bmp); m_rectLogo = CRect (CPoint (max (0, (nNewDlgWidth - bmp.bmWidth) / 2), 8), CSize (bmp.bmWidth, bmp.bmHeight)); m_iLogoAreaHeight = bmp.bmHeight + 20; } //--------------------------- // Adjust parent window size: //--------------------------- pFD->ModifyStyle (WS_THICKFRAME, WS_DLGFRAME | WS_BORDER); pFD->ModifyStyleEx (WS_EX_WINDOWEDGE, 0); pFD->SetWindowPos (NULL, -1, -1, nNewDlgWidth, rectClient.Height () + iBorderHeight * 2 + m_iLogoAreaHeight + m_iExtraHeight, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); //------------------- // Move all controls: //------------------- CWnd* pWndChild = pFD->GetWindow (GW_CHILD); while (pWndChild != NULL) { CRect rectCtl; pWndChild->GetClientRect (rectCtl); pWndChild->MapWindowPoints (pFD, rectCtl); pWndChild->SetWindowPos (NULL, rectCtl.left + iBorderWidth, rectCtl.top + iBorderHeight + m_iLogoAreaHeight, rectCtl.Width (), rectCtl.Height (), SWP_NOZORDER | SWP_NOACTIVATE); pWndChild = pWndChild->GetNextWindow (); } //------------------------------------------ // Create new and recent file list controls: //------------------------------------------ CRect rectList (0, 0, 0, 0); m_wndNewList.Create (WS_VISIBLE | WS_BORDER | WS_TABSTOP | WS_CHILD | LVS_ICON | LVS_AUTOARRANGE | LVS_SINGLESEL, rectList, pFD, iNewListCtrlId); m_wndNewList.ModifyStyleEx (0, WS_EX_CLIENTEDGE); if (m_pImagesNew != NULL) { m_wndNewList.SetImageList (m_pImagesNew, LVSIL_NORMAL); } int i = 0; for (POSITION pos = m_lstNewItems.GetHeadPosition (); pos != NULL; i ++) { CNewItemInfo* pInfo = (CNewItemInfo*) m_lstNewItems.GetNext (pos); ASSERT_VALID (pInfo); m_wndNewList.InsertItem (i, pInfo->m_strName, pInfo->m_iIconIndex); } m_wndRecentList.Create (WS_TABSTOP | WS_CHILD | WS_BORDER | LVS_SINGLESEL | LVS_REPORT, rectList, pFD, iRecentListCtrlId); m_wndRecentList.ModifyStyleEx (0, WS_EX_CLIENTEDGE); m_ImagesRecent.Create ( globalData.m_sizeSmallIcon.cx, globalData.m_sizeSmallIcon.cy, ILC_COLOR, 0, 10); m_wndRecentList.SetImageList (&m_ImagesRecent, LVSIL_SMALL); { CBCGPLocalResource locaRes; CString strFile; strFile.LoadString (IDS_BCGBARRES_FILE); m_wndRecentList.InsertColumn (0, strFile, LVCFMT_LEFT, 100); CString strFolder; strFolder.LoadString (IDS_BCGBARRES_FOLDER); m_wndRecentList.InsertColumn (1, strFolder); } CRecentFileList* pMRUFiles = ((CBCGApp*) AfxGetApp ())->m_pRecentFileList; if (pMRUFiles != NULL) { TCHAR szCurDir [_MAX_PATH + 1]; ::GetCurrentDirectory (_MAX_PATH, szCurDir); int nCurDir = lstrlen (szCurDir); ASSERT (nCurDir >= 0); szCurDir [nCurDir] = _T('\\'); szCurDir [++ nCurDir] = _T('\0'); //--------------- // Add MRU files: //--------------- int iNumOfFiles = 0; // Actual added to menu for (int i = 0; i < pMRUFiles->GetSize (); i ++) { CString strFile = (*pMRUFiles) [i]; if (!strFile.IsEmpty ()) { CString strPath; CString strName; int iImage = -1; int iIndex = strFile.ReverseFind (_T('\\')); if (iIndex != -1) { strPath = strFile.Left (iIndex); strName = strFile.Mid (iIndex + 1); } else { strName = strFile; } SHFILEINFO sfi; HIMAGELIST himlSmall = (HIMAGELIST) SHGetFileInfo (strFile, 0, &sfi, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX | SHGFI_SMALLICON); if (himlSmall != NULL) { CImageList* pImages = CImageList::FromHandle (himlSmall); ASSERT (pImages != NULL); HICON hIcon = pImages->ExtractIcon (sfi.iIcon); iImage = m_ImagesRecent.Add (hIcon); if (hIcon != NULL) { ::DestroyIcon (hIcon); } } iIndex = m_wndRecentList.InsertItem (iNumOfFiles ++, strName, iImage); m_wndRecentList.SetItemText (iIndex, 1, strPath); int iPathWidth = m_wndRecentList.GetStringWidth (strPath) + 20; if (iPathWidth > m_wndRecentList.GetColumnWidth (1)) { m_wndRecentList.SetColumnWidth (1, iPathWidth); } } } } //--------------------- // Create tabs control: //--------------------- CRect rectTabs; pFD->GetClientRect (rectTabs); rectTabs.DeflateRect (4, 4); rectTabs.top += m_iLogoAreaHeight; m_wndTab.Create (CBCGPTabWnd::STYLE_3D, rectTabs, pFD, iTabCtrlId, CBCGPTabWnd::LOCATION_TOP); m_wndTab.m_pParent = this; m_wndTab.SetActiveTabBoldFont (); m_wndTab.SetFont (GetFont ()); m_wndTab.SetOwner (this); m_wndDummy.Create (_T(""), WS_CHILD, CRect (0, 0, 0, 0), this); { CBCGPLocalResource locaRes; CString strTab; if (m_bNewPage) { m_wndTab.AddTab (&m_wndDummy, IDS_BCGBARRES_NEW_FILE, (UINT)-1, FALSE); } m_wndTab.AddTab (&m_wndDummy, IDS_BCGBARRES_EXISTING, (UINT)-1, FALSE); m_wndTab.AddTab (&m_wndDummy, IDS_BCGBARRES_RECENT, (UINT)-1, FALSE); } pFD->CenterWindow (); pFD->SetWindowText (m_strCaption); //------------------ // Set dilaog icons: //------------------ if (m_hIconSmall != NULL) { pFD->SetIcon (m_hIconSmall, FALSE); } if (m_hIconBig != NULL) { pFD->SetIcon (m_hIconBig, TRUE); } //-------------------------- // Setup parent window proc: //-------------------------- m_wndProc = (WNDPROC)SetWindowLongPtr(pFD->m_hWnd, GWLP_WNDPROC, (LONG_PTR) CBCGPFileDialog::WindowProcNew); }
void CQuickParseView::DoDataExchange(CDataExchange* pDX) { CFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(CQuickParseView) DDX_Check(pDX, IDC_CHECKTrace, m_bTrace); DDX_Text(pDX, IDC_EDITInput, m_sInput); DDX_Text(pDX, IDC_EDITAmpleOutput, m_sOutput); DDX_Text(pDX, IDC_EDITTraceMorphs, m_sTraceMorphs); DDX_Check(pDX, IDC_CHECKManualParse, m_bManualParse); //}}AFX_DATA_MAP if(!pDX->m_bSaveAndValidate) { CEdit* pE = ( CEdit*)GetDlgItem(IDC_EDITTraceMorphs); if(pE) pE->EnableWindow(m_bTrace); #ifndef hab218 CButton* pB = (CButton*)GetDlgItem(IDC_CHECKManualParse); if (pB) pB->EnableWindow(m_bTrace); CStatic* pS = (CStatic*)GetDlgItem(IDC_STATICManualParse); if (pS) pS->EnableWindow(m_bTrace); #endif // hab218 } // i removed the button because opening a window with this text // will take some more work if(!pDX->m_bSaveAndValidate && m_pAmpleProcess) { //CWnd* pButton = GetDlgItem(IDC_Errors); CWnd* pMessage = GetDlgItem(IDC_ErrorStatic); CWnd* pMessageNoTrace = GetDlgItem(IDC_ErrorStatic2); CWnd* pIcon = GetDlgItem(IDC_ErrorIcon); CWnd* pMessageRefreshed = GetDlgItem(IDC_RefreshNotice); // jdh 3/14/2000 if(m_bDidRefresh) pMessageRefreshed->ModifyStyle(NULL, WS_VISIBLE); else pMessageRefreshed->ModifyStyle(WS_VISIBLE,NULL); pMessageRefreshed->Invalidate(); if(/*pButton &&*/ pIcon && m_pAmpleProcess->getLastRunHadError()) { //pButton->ModifyStyle(NULL, WS_VISIBLE); pMessage->ModifyStyle(NULL, WS_VISIBLE); pMessage->Invalidate(); if(!m_bTrace) { pMessageNoTrace->ModifyStyle(NULL, WS_VISIBLE); pMessageNoTrace->Invalidate(); } else // trace is on { pMessageNoTrace->ModifyStyle(WS_VISIBLE, NULL); pMessageNoTrace->Invalidate(); } pIcon->ModifyStyle(NULL, WS_VISIBLE); pIcon->Invalidate(); } else if(/*pButton &&*/ pIcon) { //pButton->ModifyStyle(WS_VISIBLE, NULL); pMessage->ModifyStyle(WS_VISIBLE, NULL); pMessage->Invalidate(); pMessageNoTrace->ModifyStyle(WS_VISIBLE, NULL); pMessageNoTrace->Invalidate(); pIcon->ModifyStyle(WS_VISIBLE, NULL); pIcon->Invalidate(); } this->Invalidate(); } }
void COXDragDockContext::EndDrag() { CancelDrag(); if (m_ptStart == m_ptLast) return; m_dwOverDockStyle = m_bForceFrame ? 0 : CanDock(); if (m_dwOverDockStyle != 0) { // dockbar we're going to dock at. CDockBar* pDockBar = GetDockBar(); ASSERT(pDockBar != NULL); // check the original dockbar - if a valid CSizeDockBar... // work out the row number. CDockBar* pOrigDockBar = m_pBar->m_pDockBar; int nOrigCheckSum = -1; if (pOrigDockBar != NULL && pOrigDockBar->IsKindOf(RUNTIME_CLASS(COXSizeDockBar))) nOrigCheckSum = ((COXSizeDockBar*)pOrigDockBar)->CheckSumBars(); // Now we're going to actually dock the window. // Update the appropriate size in the control bar. if (HORZF(m_dwOverDockStyle)) { ((COXSizeControlBar*)m_pBar)->m_HorzDockSize = m_rectDragDock.Size(); } else { ((COXSizeControlBar*)m_pBar)->m_VertDockSize = m_rectDragDock.Size(); } m_pDockSite->DockControlBar(m_pBar, pDockBar, m_rectDragDock); // if into a sizeable dockbar (always we be !), then adjust other bars in the same row // to attempt to maintain size if (pDockBar->IsKindOf(RUNTIME_CLASS(COXSizeDockBar))) { if (pOrigDockBar != pDockBar || ((COXSizeDockBar*)pDockBar)->CheckSumBars() != nOrigCheckSum) { ((COXSizeDockBar*)pDockBar)->AdjustForNewBar(m_pBar); } // force RecalcLayout below to adjust sizes always for the bar into // which we have docked - this is needed as if the bar doesn't // actually changed position in the array, but has changed size // (because the docking algorithm above guess the size wrong, then // we need to set it back again. ((COXSizeDockBar*)pDockBar)->m_CountBars = 0; } // This RecalcLayout is what will adjust the size. m_pDockSite->RecalcLayout(); } else { m_ptMRUFloatPos = m_rectFrameDragHorz.TopLeft(); m_pDockSite->FloatControlBar(m_pBar, m_rectFrameDragHorz.TopLeft(), CBRS_ALIGN_TOP | (m_dwDockStyle & CBRS_FLOAT_MULTI)); m_pBar->SendMessage(WM_OX_APP_AFTERFLOAT_MSG); // set flag to indicate user has moved the bar - done as a style flag on the window. CWnd* pFrameWnd = m_pBar->GetParentFrame(); ASSERT(pFrameWnd->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd))); pFrameWnd->ModifyStyle(0, CBRS_MOVED_BY_USER); } }
void CSplitterWndEx::RecalcLayout() { ASSERT_VALID(this); ASSERT(m_nRows > 0 && m_nCols > 0); // must have at least one pane CRect rectClient; GetClientRect(rectClient); rectClient.InflateRect(-m_cxBorder, -m_cyBorder); rectClient.top += m_upBorder; CRect rectInside; GetInsideRect(rectInside); // layout columns (restrict to possible sizes) LayoutRowCol(m_pColInfo, m_nCols, rectInside.Width(), m_cxSplitterGap); LayoutRowCol(m_pRowInfo, m_nRows, rectInside.Height(), m_cySplitterGap); // adjust the panes (and optionally scroll bars) // give the hint for the maximum number of HWNDs AFX_SIZEPARENTPARAMS layout; layout.hDWP = ::BeginDeferWindowPos((m_nCols + 1) * (m_nRows + 1) + 1); // size of scrollbars int cx = (rectClient.right - rectInside.right - bNotWin4);// - afxData.bNotWin4; int cy = (rectClient.bottom - rectInside.bottom - bNotWin4);// - afxData.bNotWin4; // reposition size box if (m_bHasHScroll && m_bHasVScroll) { CWnd* pScrollBar = GetDlgItem(AFX_IDW_SIZE_BOX); ASSERT(pScrollBar != NULL); // fix style if necessary BOOL bSizingParent = (GetSizingParent() != NULL); // modifyStyle returns TRUE if style changes if (pScrollBar->ModifyStyle(SBS_SIZEGRIP|SBS_SIZEBOX, bSizingParent ? SBS_SIZEGRIP : SBS_SIZEBOX)) pScrollBar->Invalidate(); pScrollBar->EnableWindow(bSizingParent); // reposition the size box DeferClientPos(&layout, pScrollBar, rectInside.right + bNotWin4, rectInside.bottom + bNotWin4, cx, cy, TRUE); } // reposition scroll bars if (m_bHasHScroll) { int cxSplitterBox = m_cxSplitter + bNotWin4;// split box bigger int x = rectClient.left; int y = rectInside.bottom + bNotWin4; for (int col = 0; col < m_nCols; col++) { CWnd* pScrollBar = GetDlgItem(AFX_IDW_HSCROLL_FIRST + col); ASSERT(pScrollBar != NULL); int cx = m_pColInfo[col].nCurSize; if (col == 0 && m_nCols < m_nMaxCols) x += cxSplitterBox, cx -= cxSplitterBox; DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE); x += cx + m_cxSplitterGap; } } if (m_bHasVScroll) { int cySplitterBox = m_cySplitter + bNotWin4;// split box bigger int x = rectInside.right + bNotWin4; int y = rectClient.top; for (int row = 0; row < m_nRows; row++) { CWnd* pScrollBar = GetDlgItem(AFX_IDW_VSCROLL_FIRST + row); ASSERT(pScrollBar != NULL); int cy = m_pRowInfo[row].nCurSize; if (row == 0 && m_nRows < m_nMaxRows) y += cySplitterBox, cy -= cySplitterBox; DeferClientPos(&layout, pScrollBar, x, y, cx, cy, TRUE); y += cy + m_cySplitterGap; } } //BLOCK: Reposition all the panes { int x = rectClient.left; for (int col = 0; col < m_nCols; col++) { int cx = m_pColInfo[col].nCurSize; int y = rectClient.top; for (int row = 0; row < m_nRows; row++) { int cy = m_pRowInfo[row].nCurSize; CWnd* pWnd = GetPane(row, col); DeferClientPos(&layout, pWnd, x, y, cx, cy, FALSE); y += cy + m_cySplitterGap; } x += cx + m_cxSplitterGap; } } // move and resize all the windows at once! if (layout.hDWP == NULL || !::EndDeferWindowPos(layout.hDWP)) TRACE0("Warning: DeferWindowPos failed - low system resources.\n"); // invalidate all the splitter bars (with NULL pDC) DrawAllSplitBars(NULL, rectInside.right, rectInside.bottom); }