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 » Wrong NC calculation for CExtNCW < > with Office 2007 themes Collapse All
Subject Author Date
Hans Bergmeister Aug 21, 2007 - 12:30 PM

Hello,

I just detected something, that seems to be a bug. It can be easily reproduced with your IconEditor sample. Copy the following code to the beginning of CMainDlg::OnInitDialog(), please:

BOOL CMainDlg::OnInitDialog()
{
    CRect rcCli;
    GetClientRect(rcCli);

    CRect rcCalc = rcCli;
    CalcWindowRect(rcCalc);

    CRect rcWin;
    GetWindowRect(rcWin);

    ASSERT(rcWin.Size() == rcCalc.Size());

It is my understanding, that CalcWindowRect() returns the same dimensions as GetWindowRect(), if the client rectangle is passed to CalcWindowRect(). And as expected the above code works fine with all non Office 2007 themes. With an Office2007 theme, however, an assertion occurs, because CalcWindowRect() seems to return wrong dimensions. Is there something wrong in your NC calc handlers?


Best regards.

Technical Support Aug 22, 2007 - 11:30 AM

The CExtNCW template class completely recomputes and repaints the window non-client area. In the case of Office 2007 and ProfSkin themes, the non-client area metrics are not equal to the current Windows window metrics. The CExtPaintManager::NcFrame_IsSupported() method returns a flag which indicates if the current paint manager supports window non-client area skinning. The following two methods of the CExtPaintManager class compute the size of the caption and border for the specified window:

      virtual INT NcFrame_GetCaptionHeight(
            bool bActive,
            const CWnd * pWnd,
            LPARAM lParam = 0L
            ) const;
      virtual void NcFrame_GetMetrics(
            RECT & rcNcBorders,// returns border sizes
            RECT & rcThemePadding,
            const CWnd * pWnd,
            LPARAM lParam = 0L
            ) const;
We could implement the CalcWindowRect() method in the CExtNCW template class using the paint manager’s APIs specified above.

Hans Bergmeister Aug 23, 2007 - 1:25 AM

Hello,

yes, an additional CalcWindowRect() method in the CExtNCW template would help to avoid errors.

Technical Support Aug 25, 2007 - 11:41 AM

Please download the updated ExtNcFrame.h and ExtNcFrame.cpp files

UpdatedCExtNCW.zip

You should replace the files with the same names in ../Prof-UIS/Include and ../Prof-UIS/Src folders. This updated version of the CExtNCW class now supports the CalcWindowRect() method.