/*************************************************** CUGCheckBoxType - Constructor Initialize variables, and create commonly used pens ***************************************************/ CUGCheckBoxType::CUGCheckBoxType() { // make sure that user cannot start edit this cell type m_canTextEdit = FALSE; // also, this cell type cannot overlap m_canOverLap = FALSE; // create pen objects, later used for drawing m_lightPen.CreatePen(PS_SOLID,1,RGB(225,225,225)); m_darkPen.CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNSHADOW)); m_facePen.CreatePen(PS_SOLID,1,GetSysColor(COLOR_BTNFACE)); m_hbrDither = NULL; HBITMAP hbmGray = CreateDitherBitmap(); if( hbmGray != NULL ) { ASSERT( m_hbrDither == NULL ); m_hbrDither = ::CreatePatternBrush( hbmGray ); ::DeleteObject( (HGDIOBJ)hbmGray ); } }
void AFX_GLOBAL_DATA::UpdateSysColors() { m_bIsBlackHighContrast = ::GetSysColor(COLOR_3DLIGHT) == RGB(255, 255, 255) && ::GetSysColor(COLOR_3DFACE) == RGB(0, 0, 0); m_bIsWhiteHighContrast = ::GetSysColor(COLOR_3DDKSHADOW) == RGB(0, 0, 0) && ::GetSysColor(COLOR_3DFACE) == RGB(255, 255, 255); CWindowDC dc(NULL); m_nBitsPerPixel = dc.GetDeviceCaps(BITSPIXEL); clrBarFace = clrBtnFace = ::GetSysColor(COLOR_BTNFACE); clrBarShadow = clrBtnShadow = ::GetSysColor(COLOR_BTNSHADOW); clrBarDkShadow = clrBtnDkShadow = ::GetSysColor(COLOR_3DDKSHADOW); clrBarLight = clrBtnLight = ::GetSysColor(COLOR_3DLIGHT); clrBarHilite = clrBtnHilite = ::GetSysColor(COLOR_BTNHIGHLIGHT); clrBarText = clrBtnText = ::GetSysColor(COLOR_BTNTEXT); clrGrayedText = ::GetSysColor(COLOR_GRAYTEXT); clrWindowFrame = ::GetSysColor(COLOR_WINDOWFRAME); clrHilite = ::GetSysColor(COLOR_HIGHLIGHT); clrTextHilite = ::GetSysColor(COLOR_HIGHLIGHTTEXT); clrBarWindow = clrWindow = ::GetSysColor(COLOR_WINDOW); clrWindowText = ::GetSysColor(COLOR_WINDOWTEXT); clrCaptionText = ::GetSysColor(COLOR_CAPTIONTEXT); clrMenuText = ::GetSysColor(COLOR_MENUTEXT); clrActiveCaption = ::GetSysColor(COLOR_ACTIVECAPTION); clrInactiveCaption = ::GetSysColor(COLOR_INACTIVECAPTION); clrActiveCaptionGradient = ::GetSysColor(COLOR_GRADIENTACTIVECAPTION); clrInactiveCaptionGradient = ::GetSysColor(COLOR_GRADIENTINACTIVECAPTION); clrActiveBorder = ::GetSysColor(COLOR_ACTIVEBORDER); clrInactiveBorder = ::GetSysColor(COLOR_INACTIVEBORDER); clrInactiveCaptionText = ::GetSysColor(COLOR_INACTIVECAPTIONTEXT); if (m_bIsBlackHighContrast) { clrHotLinkNormalText = clrWindowText; clrHotLinkHoveredText = clrWindowText; clrHotLinkVisitedText = clrWindowText; } else { clrHotLinkNormalText = ::GetSysColor(COLOR_HOTLIGHT); clrHotLinkHoveredText = RGB(0, 0, 255); // Bright blue clrHotLinkVisitedText = RGB(128, 0, 128); // Violet } hbrBtnShadow = ::GetSysColorBrush(COLOR_BTNSHADOW); ENSURE(hbrBtnShadow != NULL); hbrBtnHilite = ::GetSysColorBrush(COLOR_BTNHIGHLIGHT); ENSURE(hbrBtnHilite != NULL); hbrWindow = ::GetSysColorBrush(COLOR_WINDOW); ENSURE(hbrWindow != NULL); brBtnFace.DeleteObject(); brBtnFace.CreateSolidBrush(clrBtnFace); brBarFace.DeleteObject(); brBarFace.CreateSolidBrush(clrBarFace); brActiveCaption.DeleteObject(); brActiveCaption.CreateSolidBrush(clrActiveCaption); brInactiveCaption.DeleteObject(); brInactiveCaption.CreateSolidBrush(clrInactiveCaption); brHilite.DeleteObject(); brHilite.CreateSolidBrush(clrHilite); brBlack.DeleteObject(); brBlack.CreateSolidBrush(clrBtnDkShadow); brWindow.DeleteObject(); brWindow.CreateSolidBrush(clrWindow); penHilite.DeleteObject(); penHilite.CreatePen(PS_SOLID, 1, afxGlobalData.clrHilite); penBarFace.DeleteObject(); penBarFace.CreatePen(PS_SOLID, 1, afxGlobalData.clrBarFace); penBarShadow.DeleteObject(); penBarShadow.CreatePen(PS_SOLID, 1, afxGlobalData.clrBarShadow); if (brLight.GetSafeHandle()) { brLight.DeleteObject(); } if (m_nBitsPerPixel > 8) { COLORREF clrLight = RGB(GetRValue(clrBtnFace) +((GetRValue(clrBtnHilite) - GetRValue(clrBtnFace)) / 2 ), GetGValue(clrBtnFace) +((GetGValue(clrBtnHilite) - GetGValue(clrBtnFace)) / 2), GetBValue(clrBtnFace) +((GetBValue(clrBtnHilite) - GetBValue(clrBtnFace)) / 2)); brLight.CreateSolidBrush(clrLight); } else { HBITMAP hbmGray = CreateDitherBitmap(dc.GetSafeHdc()); ENSURE(hbmGray != NULL); CBitmap bmp; bmp.Attach(hbmGray); brLight.CreatePatternBrush(&bmp); } // CMenuImages::CleanUp(); // CDockingManager::m_bSDParamsModified = TRUE; }