void CResizableDialog::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); if (nType == SIZE_MAXHIDE || nType == SIZE_MAXSHOW) return; // arrangement not needed if ((m_bShowGrip)||(!IsDwmCompositionEnabled())) { if (nType == SIZE_MAXIMIZED) HideSizeGrip(&m_dwGripTempState); else ShowSizeGrip(&m_dwGripTempState); // update grip and layout UpdateSizeGrip(); } if (IsDwmCompositionEnabled()) HideGrip(); ArrangeLayout(); // on Vista, the redrawing doesn't work right, so we have to work // around this by invalidating the whole dialog so the DWM recognizes // that it has to update the application window. Invalidate(); }
inline void CResizableDialog::PrivateConstruct() { m_bEnableSaveRestore = FALSE; m_dwGripTempState = 1; m_bShowGrip = !IsDwmCompositionEnabled(); m_bRectOnly = FALSE; }
BOOL AFX_GLOBAL_DATA::DrawTextOnGlass(HTHEME hTheme, CDC* pDC, int iPartId, int iStateId, CString strText, CRect rect, DWORD dwFlags, int nGlowSize, COLORREF clrText) { if (hTheme == NULL || !IsDwmCompositionEnabled()) { pDC->DrawText(strText, rect, dwFlags); return FALSE; } CComBSTR bstmp = (LPCTSTR)strText; wchar_t* wbuf = new wchar_t[bstmp.Length() + 1]; wcscpy_s(wbuf, bstmp.Length() + 1, bstmp); DTTOPTS dto; memset(&dto, 0, sizeof(DTTOPTS)); dto.dwSize = sizeof(DTTOPTS); dto.dwFlags = DTT_COMPOSITED; if (nGlowSize > 0) { dto.dwFlags |= DTT_GLOWSIZE; dto.iGlowSize = nGlowSize; } if (clrText != (COLORREF)-1) { dto.dwFlags |= DTT_TEXTCOLOR; dto.crText = clrText; } DrawThemeTextEx(hTheme, pDC->GetSafeHdc(), iPartId, iStateId, wbuf, -1, dwFlags, rect, &dto); delete [] wbuf; return TRUE; }