void MfcViewAdapter::redraw(bool) { if (_wnd->GetSafeHwnd()) { _coreView->submitDynamicShapes(this); _wnd->InvalidateRect(NULL, FALSE); } }
void CDocumentPreview::SizePreviewWindow(int nWidth, int nHeight) { m_crPreview.left = (m_crFullPreview.left+m_crFullPreview.right-nWidth)/2; m_crPreview.top = (m_crFullPreview.top+m_crFullPreview.bottom-nHeight)/2; m_crPreview.right = m_crPreview.left + nWidth; m_crPreview.bottom = m_crPreview.top + nHeight; CRect r = m_crPreview; // We can't both set and show the window at the same time // with SetWindowPos. So, we call it twice as needed. CWnd* pPreviewWnd = GetPreviewWnd(); pPreviewWnd->SetWindowPos(NULL, r.left-1, r.top-1, nWidth+2, nHeight+2, SWP_NOZORDER | SWP_NOREDRAW); pPreviewWnd->SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOREDRAW | SWP_SHOWWINDOW); // Invalidate ourselves to avoid background draw. CWnd* pDialog = GetDialog(); pDialog->ClientToScreen(&m_crPreview); pPreviewWnd->ScreenToClient(&m_crPreview); r = m_crPreview; r.left--; r.top--; r.right++; r.bottom++; pPreviewWnd->InvalidateRect(&r, FALSE); }
void CPhotoProjectsTypeDlg::UpdatePreview(void) { CWnd* pPreview = GetDlgItem(IDC_PREVIEW); if (pPreview != NULL) { pPreview->InvalidateRect(NULL); } }
void CEnvelopeTypeDialog::UpdatePreview(void) { CWnd* pPreview = GetDlgItem(IDC_MAKE_PREVIEW); if (pPreview != NULL) { pPreview->InvalidateRect(NULL); } }
void CImgButton::InvalidateParent() { CRect rect; GetWindowRect(rect); CWnd* pParent = GetParent(); if(::IsWindow(pParent->GetSafeHwnd())) { pParent->ScreenToClient(rect); pParent->InvalidateRect(rect, FALSE); } }
void CSizingDialog::ResizeControls() { // XR: size of the dialog moving CRect rcDlg; this->GetWindowRect(&rcDlg); int dx = rcDlg.Width() - m_rcInit.Width(); int dy = rcDlg.Height() - m_rcInit.Height(); // XR: move the controls POSITION pos = m_mapPtToInfo.GetStartPosition(); while (pos != NULL) { HWND hCtrl; CCtrlInfo* pInfo; m_mapPtToInfo.GetNextAssoc(pos, (void *&)hCtrl, (void *&)pInfo); TRACE("this: 0x%xd\n", this); TRACE("0x%xd\n", ::GetDlgItem(m_hWnd, IDCANCEL)); TRACE("0x%xd\n", ::GetDlgItem(m_hWnd, IDOK)); TRACE("0x%xd\n", hCtrl); ASSERT(::IsWindow(hCtrl)); ASSERT(::IsChild(this->m_hWnd, hCtrl)); CWnd* pCtrl = FromHandle(hCtrl); if (::IsGroupBox(pCtrl)) { ::ResizeGroupBox(pCtrl, this, pInfo, dx, dy); continue; } CRect rcCtrlOld; pCtrl->GetWindowRect(&rcCtrlOld); this->ScreenToClient(&rcCtrlOld); CRect rcCtrl = pInfo->m_rcInit; rcCtrl.left += LONG(dx*pInfo->m_dRateLeft); rcCtrl.right += LONG(dx*pInfo->m_dRateRight); rcCtrl.top += LONG(dy*pInfo->m_dRateTop); rcCtrl.bottom += LONG(dy*pInfo->m_dRateBottom); // BOOL bVisible = ::IsWindowVisible(pCtrl->m_hWnd); pCtrl->SetRedraw(FALSE); pCtrl->MoveWindow(&rcCtrl); // if (!bVisible) // continue; pCtrl->SetRedraw(TRUE); this->InvalidateCtrlBorder(&rcCtrlOld, &rcCtrl); pCtrl->InvalidateRect(NULL); } }
void CStaticTrans::UpdateCtrl() { CWnd* pParent = GetParent(); CRect rect; GetWindowRect(rect); pParent->ScreenToClient(rect); rect.DeflateRect(2, 2); pParent->InvalidateRect(rect, FALSE); }
void CRevertListDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if (!m_InitDialogDone) return; // Compute the change in width (dx) CRect rect; GetWindowRect(&rect); int dx = rect.Width() - m_LastRect.Width(); int dy = rect.Height() - m_LastRect.Height(); // Save the new size m_LastRect = rect; // Widen the list box by the change in width (dx) and // heighten the list box by the change in height (dy) m_List.GetWindowRect(&rect); m_List.SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top + dy, SWP_NOMOVE | SWP_NOZORDER); // Slide the buttons to the right by the change in width // and down by the change in height CWnd *pWnd = GetDlgItem(IDOK); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDCANCEL); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(ID_DELETESELECTED); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); }
void MfcViewAdapter::regenAll(bool changed) { if (changed) { _coreView->submitBackDoc(this, changed); } _coreView->submitDynamicShapes(this); _canvas.clearCachedBitmap(); if (_wnd->GetSafeHwnd()) { _wnd->InvalidateRect(NULL, FALSE); } }
void GPInvalidateBk( CWnd& item ) { CWnd* pWnd = item.GetParent(); if (!pWnd) { return; } CRect rcThis; item.GetWindowRect(rcThis); pWnd->ScreenToClient(rcThis); pWnd->InvalidateRect(rcThis); }
void CGetPwdDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if (!m_InitDialogDone) return; // Compute the change in width (dx) CRect rect; GetWindowRect(&rect); int dx = rect.Width() - m_LastRect.Width(); // Save the new size m_LastRect = rect; // Widen the text fields by the change in width (dx) and GetDlgItem( IDC_STATICMSG )->GetWindowRect(&rect); GetDlgItem( IDC_STATICMSG )->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); GetDlgItem( IDC_STATICMSG )->InvalidateRect(NULL); GetDlgItem( IDC_PASSWORD )->GetWindowRect(&rect); GetDlgItem( IDC_PASSWORD )->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); GetDlgItem( IDC_PASSWORD )->InvalidateRect(NULL); // Slide the buttons to the right by the change in width CWnd *pWnd = GetDlgItem(IDOK); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDCANCEL); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); }
void CDocumentPreview::ErasePreview(void) { CRect r = m_crPreview; r.InflateRect(1, 1); CWnd* pPreviewWnd = GetPreviewWnd(); CWnd* pDialog = GetDialog(); if (pPreviewWnd != NULL && pDialog != NULL) { pPreviewWnd->ClientToScreen(&r); pDialog->ScreenToClient(&r); pDialog->InvalidateRect(&r); } }
void CMainFrame::OnUnsplit() { if ( m_wndSplitter.GetRowCount() == 1 ) return; m_wndSplitter.SavePosition(); m_wndSplitter.DeleteRow(0); CWnd* pWnd = m_wndSplitter.GetPane(0, 0); pWnd->InvalidateRect(NULL, FALSE); pWnd->UpdateWindow(); }
void CBarButton::Repaint() { if (!m_hWnd) return; CWnd* pWnd = GetParent(); if (pWnd != NULL && m_bTransparent) { CRect rcClient; GetWindowRect(&rcClient); pWnd->ScreenToClient(&rcClient); pWnd->InvalidateRect(rcClient); } else Invalidate(); }
void GPInvalidateItemBk( CWnd* pWndIn ) { if (!pWndIn) { return; } CWnd* pPar = pWndIn->GetParent(); if (!pPar) { return; } CRect rcWnd; pWndIn->GetWindowRect(rcWnd); pPar->ScreenToClient(rcWnd); pPar->InvalidateRect(&rcWnd, TRUE); }
void CxStatic::SetWindowText( LPCTSTR strText) { m_strText = strText; CRect Rect; GetClientRect(&Rect); if ( m_bTransparentBk ){ ClientToScreen(&Rect); Rect.InflateRect(1,1,1,1); CWnd *Parent = GetParent(); Parent->ScreenToClient(&Rect); Parent->InvalidateRect(&Rect); Parent->UpdateWindow(); //SendMessage(WM_ERASEBKGND); } else RedrawWindow(); }
void URLLabel::OnMouseLeave() { reg_mouseleave = false; mouse_hover = false; // repaint our window CWnd *parent = GetParent(); if (parent) { CPoint pt(0, 0); parent->ClientToScreen(&pt); CPoint op(0, 0); ClientToScreen(&op); CRect rc; GetClientRect(&rc); rc.OffsetRect(op.x - pt.x, op.y - pt.y); parent->InvalidateRect(&rc); Invalidate(); } }
void CRollLabel::Repaint() { if (m_bTransparentBk) { CWnd* pParent = GetParent(); if (pParent) { CRect rcRepaint = m_rcClient; ClientToScreen(&rcRepaint); pParent->ScreenToClient(&rcRepaint); pParent->InvalidateRect(rcRepaint); } else { Invalidate(); } } else { Invalidate(); } }
// handle mouse enter/leave void URLLabel::OnMouseMove(UINT nFlags, CPoint point) { if (!reg_mouseleave) { reg_mouseleave = true; // we want to receive the WM_MOUSELEAVE notification TRACKMOUSEEVENT tm; tm.cbSize = sizeof(tm); tm.dwFlags = TME_LEAVE; tm.dwHoverTime = 0; tm.hwndTrack = *this; TrackMouseEvent(&tm); } if (!mouse_hover) { mouse_hover = true; // repaint our window CWnd *parent = GetParent(); if (parent) { CPoint pt(0, 0); parent->ClientToScreen(&pt); CPoint op(0, 0); ClientToScreen(&op); CRect rc; GetClientRect(&rc); rc.OffsetRect(op.x - pt.x, op.y - pt.y); parent->InvalidateRect(&rc); Invalidate(); } } }
void CForceSyncDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if (!m_InitDialogDone) return; // Compute the change in width (dx) CRect rect; GetWindowRect(&rect); int dx = rect.Width() - m_LastRect.Width(); int dy = rect.Height() - m_LastRect.Height(); // Save the new size m_LastRect = rect; // Widen the list box by the change in width (dx) and // heighten the list box by the change in height (dy) m_List.GetWindowRect(&rect); m_List.SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top + dy, SWP_NOMOVE | SWP_NOZORDER); // Widen the group and combo boxes by the change in width // Slide them down by the change in height CWnd *pWnd = GetDlgItem(IDC_STATIC1); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left, rect.top + dy, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOZORDER); pWnd = GetDlgItem(IDC_EDITCHANGNUM); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left, rect.top + dy, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); // Slide radio buttons and the static text at the bottom // down by the change in height pWnd = GetDlgItem(IDC_OPEN); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDC_FORCERESYNC); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDC_STATIC2); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); // Slide the buttons to the right by the change in width // and down by the change in height pWnd = GetDlgItem(IDOK); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDC_DELETESELECTED); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDCANCEL); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDHELP); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); }
void COldChgFilterDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); CWnd * pWnd = GetDlgItem(IDC_FILES); // Have we finished initializing? if (!pWnd || !IsWindow(pWnd->m_hWnd) || !m_LastRect.Width()) return; // Compute the change in width (dx) CRect rect; GetWindowRect(&rect); int dx = rect.Width() - m_LastRect.Width(); // Save the new size m_LastRect = rect; // Widen the group boxes by the change in width (dx) pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDC_CRITERIA); pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); // Widen the 2 file combo/edit boxes by the change in width pWnd = GetDlgItem(IDC_FILESPEC); pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); pWnd = GetDlgItem(IDC_SELECTED); pWnd->GetWindowRect(&rect); pWnd->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx, rect.bottom - rect.top, SWP_NOMOVE | SWP_NOZORDER); // Slide the buttons to the right by the change in width pWnd = GetDlgItem(IDC_SETREVRANGE); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDOK); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDCANCEL); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); pWnd = GetDlgItem(IDHELP); pWnd->GetWindowRect(&rect); ScreenToClient(rect); pWnd->SetWindowPos(NULL, rect.left + dx, rect.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); pWnd->InvalidateRect(NULL, TRUE); }