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 General Discussion » Maximize Application in custom Style Collapse All
Subject Author Date
Dirk lindner Mar 23, 2009 - 4:19 AM

Hello, i have subclass the CExtPaintManagerOffice2007_R1 style.
I have a problem if i dock the Taskbar left and maximize the applicatrion it looks like



Here is the source ...

#include <ExtPaintManager.h>
#pragma once
#ifndef GISMOTHEME_H
#define GISMOTHEME_H
//in 4wndframe deklariert
extern COLORREF g_ColorHighlight;
extern COLORREF g_ColorBackground;
extern COLORREF g_ColorBorder;    
/*!
Mit doxygen kommentiert ...
http://www.stack.nl/~dimitri/doxygen/commands.html

\fn GismoTheme::GismoTheme

\brief abgeleiteter paintmanger style.

Wird benötigt um den style zu verändern.

*/

class GismoTheme : public CExtPaintManagerOffice2007_R1
{
public:
    DECLARE_DYNCREATE( GismoTheme )
    GismoTheme()
    {
        //hintergrund z.Bsp seperatoren
        m_clrFillHint = stat_HLS_Adjust(
            g_ColorBackground,
            0.00, -0.07, -0.10
        );
        //menu selektion farbe
        m_clrAccentHint = stat_HLS_Adjust(
            g_ColorHighlight,
            0.00, -0.07, -0.10
        );
    }
    void NcFrame_Paint(
        CDC & dc,
        const CExtCmdIcon * pIcon,
        __EXT_MFC_SAFE_LPCTSTR strCaption,
        UINT nDrawTextAlignFlags,
        const RECT & rcFrame,
        const RECT & rcClient,
        const RECT & rcIcon,
        const RECT & rcText,
        const RECT & rcHelp,
        const RECT & rcMinimize,
        const RECT & rcMaximizeRestore,
        const RECT & rcClose,
        bool bFrameActive,
        bool bFrameEnabled,
        bool bFrameMaximized,
        e_nc_button_state_t eStateButtonHelp,
        e_nc_button_state_t eStateButtonMinimize,
        e_nc_button_state_t eStateButtonMaximizeRestore,
        e_nc_button_state_t eStateButtonClose,
        const CWnd * pWnd,
        LPARAM lParam
    ) const
    {
        CExtPaintManagerOffice2007_R1::NcFrame_Paint(
            dc,
            pIcon,
            strCaption,
            nDrawTextAlignFlags,
            rcFrame,
            rcClient,
            rcIcon,
            rcText,
            rcHelp,
            rcMinimize,
            rcMaximizeRestore,
            rcClose,
            bFrameActive /*? 0:1*/,
            0,
            bFrameMaximized,
            eStateButtonHelp,
            eStateButtonMinimize,
            eStateButtonMaximizeRestore,
            eStateButtonClose,
            pWnd,
            lParam
        );

        CPen pen(
            0,
            1,
            RGB(196,196,196)
        );
        CPen* oldPen = dc.SelectObject( &pen );
        dc.MoveTo(2,rcClient.top-1);
        dc.LineTo(rcFrame.right-2,rcClient.top-1);
        dc.SelectObject( &oldPen );
    }

protected:
    virtual bool OnQueryThemeColors(
        COLORREF *pclrFillHint,
        COLORREF *pclrAccentHint = NULL
        )
    {
        if( pclrFillHint)
            *pclrFillHint = m_clrFillHint;
        if( pclrAccentHint)
            *pclrAccentHint = m_clrAccentHint;
        return true;
    }
    virtual bool OnQueryUseThemeColors() const
    {
        return true;
    }
    virtual e_system_theme_t OnQuerySystemTheme() const
    {
        return ThemeUnknown;
    }

};
#endif //GISMOTHEME_H

IMPLEMENT_DYNCREATE(GismoTheme,CExtPaintManagerOffice2007_R1 )


Thank you !

Dirk Lindner

Dirk lindner Mar 23, 2009 - 8:43 AM

I use Prof UIS 2.83.
I thought is problem from the subclass, but it also appears if i use CExtPaintManagerOffice2007_R1 style.
With the CExtPaintManagerNativeXP style it works fine.

Technical Support Mar 24, 2009 - 2:29 PM

Thank you for reporting this issue. There are two steps to fix it:1) Find the following code inside the CExtNcFrameImpl::NcFrameImpl_PreWindowProc() method:

   case WM_SETTINGCHANGE:
            case WM_DISPLAYCHANGE:
                        NcFrameImpl_MapHtRects_Clean();
            break;

And replace it with the following:
   case WM_SETTINGCHANGE:
                        NcFrameImpl_MapHtRects_Clean();
                        if( ! NcFrameImpl_IsSupported() )
                                    break;
                        if( NcFrameImpl_IsDwmBased() )
                                    break;
                        if( wParam == SPI_SETWORKAREA )
                        {
                                    WINDOWPLACEMENT _wp;
                                    ::memset( &_wp, 0, sizeof(WINDOWPLACEMENT) );
                                    _wp.length = sizeof(WINDOWPLACEMENT);
                                    if( GetWindowPlacement( _wp ) && _wp.showCmd == SW_SHOWMAXIMIZED )
                                    {
                                                CExtPaintManager::monitor_parms_t _mp;
                                                CExtPaintManager::stat_GetMonitorParms( _mp, pWndFrameImpl );
                                                WINDOWPLACEMENT _wpAdjust;
                                                ::memcpy( &_wpAdjust, &_wp, sizeof(WINDOWPLACEMENT) );
                                                _wpAdjust.showCmd = SW_SHOWNORMAL; // SW_RESTORE;
                                                ::CopyRect( &_wpAdjust.rcNormalPosition, &_mp.m_rcWorkArea );
                                                _wpAdjust.ptMaxPosition.x = _wpAdjust.ptMaxPosition.x = _wpAdjust.rcNormalPosition.left;
                                                _wpAdjust.ptMaxPosition.y = _wpAdjust.ptMaxPosition.y = _wpAdjust.rcNormalPosition.top;
                                                SetWindowPlacement( _wpAdjust );
                                                SetWindowPlacement( _wp );
                                    }
                        }
            break;
            case WM_DISPLAYCHANGE:
                        NcFrameImpl_MapHtRects_Clean();
            break;

2) Update the source code for the following method:
bool CExtNcFrameImpl::NcFrameImpl_GetMinMaxInfo(
            LPMINMAXINFO pMMI
            ) const
{
            ASSERT( pMMI != NULL );
            if( ! NcFrameImpl_IsSupported() )
                        return false;
            if( NcFrameImpl_IsDwmBased() )
                        return true;
CWnd * pWndFrameImpl = const_cast < CWnd * > ( NcFrameImpl_GetFrameWindow() );
            if( ( pWndFrameImpl->GetStyle() & WS_CHILD ) == 0 )
            {
                        CRect rcBorders( 0, 0, 0, 1 );
                        CExtPaintManager::monitor_parms_t _mp;
                        CExtPaintManager::stat_GetMonitorParms( _mp, pWndFrameImpl );
                        pMMI->ptMaxPosition.x = rcBorders.left;
                        pMMI->ptMaxPosition.y = rcBorders.top;
                        pMMI->ptMaxTrackSize.x = pMMI->ptMaxSize.x = _mp.m_rcWorkArea.Width() - rcBorders.left - rcBorders.right;
                        pMMI->ptMaxTrackSize.y = pMMI->ptMaxSize.y = _mp.m_rcWorkArea.Height() - rcBorders.top - rcBorders.bottom;
                        APPBARDATA _data;
                        ::memset( &_data, 0, sizeof(APPBARDATA) );
                        _data.cbSize = sizeof(APPBARDATA);
                        UINT nSHR = (UINT)::SHAppBarMessage( ABM_GETSTATE, &_data );
                        if( nSHR == (ABS_AUTOHIDE|ABS_ALWAYSONTOP) )
                        {
                                    nSHR = (UINT)::SHAppBarMessage( ABM_GETTASKBARPOS, &_data );
                                    if( nSHR == 1 )
                                    {
                                                switch(_data.uEdge)
                                                {
                                                case ABE_TOP:
                                                            pMMI->ptMaxPosition.y ++;
                                                            pMMI->ptMaxSize.y --;
                                                break;
                                                case ABE_BOTTOM:
                                                            pMMI->ptMaxSize.y --;
                                                break;
                                                case ABE_LEFT:
                                                            pMMI->ptMaxPosition.x ++;
                                                            pMMI->ptMaxSize.x --;
                                                break;
                                                case ABE_RIGHT:
                                                            pMMI->ptMaxSize.x --;
                                                break;
                                                }
                                    }
                        }
            }
            return true;
}


Dirk lindner Mar 25, 2009 - 7:46 AM

Thank you !
It works fine ...

Dirk Lindner

Technical Support Mar 23, 2009 - 8:32 AM

Which Prof-UIS version you are using? The code snippet in your message is not related to the incorrect window positioning. We need to take a look at the main frame and application classes.