Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Can buttons be 3D instead of flat when using Office 2003 skin? Collapse All
Subject Author Date
Mel Sampat Sep 3, 2005 - 12:12 PM

Is there a way for buttons to remain "3D" and not completely flat when using the Office 2003 skin? I want to use the CExtResizablePropertySheet but I don’t want the OK, Cancel and Apply buttons to become flat. Same for CExtColorButton - is there a way to make it appear like standard Windows buttons (3D) instead of flat? Thanks!

Technical Support Sep 4, 2005 - 9:42 AM

You can provide buttons in the resizable property sheet with a look of the classic buttons but the solution is a bit tricky. You need to use a CExtResizablePropertySheet-derived class in which Prof-UIS buttons should not be subclassed by the parent class:

LRESULT C_YOUR_ResizablePropertySheet::
        WindowProc( UINT message, WPARAM wParam, LPARAM lParam )
{
      if( message == (WM_USER+10) && (!bSheetInitialized) )
      {
            m_bSheetInitialized = true;
            CRect rcWnd;
            GetWindowRect( &rcWnd );
            CSize sizeWnd = rcWnd.Size();
            SetMinTrackSize( sizeWnd );
            ::SetWindowPos(
                m_hWnd, NULL, 0,0,0,0,
                SWP_NOSIZE|SWP_NOMOVE
                    |SWP_NOZORDER|SWP_NOOWNERZORDER
                    |SWP_NOREPOSITION
                    |SWP_FRAMECHANGED
                );
            CTabCtrl * pTabCtrl = CExtResPS::GetTabControl();
            CWnd * pWnd = GetWindow( GW_CHILD );
            for( ; pWnd != NULL; pWnd = pWnd->GetWindow(GW_HWNDNEXT)  )
            {
                if( pTabCtrl == pWnd )
                {
                    pTabCtrl->ModifyStyle( 0, WS_CLIPSIBLINGS );
                    AddAnchor( pTabCtrl->GetSafeHwnd(), __RDA_LT, __RDA_RB );
                    continue;
                }
                CExtSafeString sClassName;
                ::GetClassName(
                    pWnd->GetSafeHwnd(),
                    sClassName.GetBuffer( _MAX_PATH+1 ),
                    _MAX_PATH
                    );
                sClassName.ReleaseBuffer();
                sClassName.MakeLower();
                if( sClassName == LPCTSTR( _T("static") ) )
                {
                    pWnd->ModifyStyle( 0, WS_CLIPSIBLINGS );
                    
#if _MFC_VER >= 0x700
                    if( (m_psh.dwFlags&PSH_WIZARD97) != 0 )
                    {
                        if( pWnd->GetDlgCtrlID() == 0x3027 )
                        {
                            AddAnchor(
                                pWnd->GetSafeHwnd(),
                                __RDA_LT,
                                __RDA_RT
                                );
                            continue;
                        }
                    }
#endif // #if _MFC_VER >= 0x700
                    AddAnchor(
                        pWnd->GetSafeHwnd(),
                        __RDA_LB,
                        __RDA_RB
                        );
                    continue;
                }
            } // for( ; pWnd != NULL; pWnd = pWnd->GetWindow(GW_HWNDNEXT)  )
            _SyncActivePage();
            CExtPaintManager::monitor_parms_t _mp;
            CExtPaintManager::stat_GetMonitorParms( _mp, this );
            SetMaximizedRect( &_mp.m_rcWorkArea );
            SetMaxTrackSize( _mp.m_rcWorkArea.Size() );
            CRect _rcWnd;
            GetWindowRect( &_rcWnd );;
            CSize _size = _rcWnd.Size();
            ::SendMessage(
                m_hWnd, WM_SIZE,
                WPARAM(SIZE_RESTORED),
                MAKELPARAM( _size.cx, _size.cy )
                );
            if( GetStyle() & WS_VISIBLE )
                RedrawWindow();
            OnResizablePropertySheetInitialized();
            return 0L;
      }
      return
            CExtResizablePropertySheet::
                  WindowProc(message,wParam,lParam);
}

Then you need to make one more change. This code will not compile until you make the CExtResizablePropertySheet::m_bSheetInitialized property protected instead of private.

To provide the color button with the classic look, create a CExtColorButton-derived class and implement the CExtColorButton::_RenderImpl() virtual method. Your method should paint the button using the classic Win32 API.