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 » CExtTabPageContainerOneNoteWnd Collapse All
Subject Author Date
Istvan Horgos Jul 19, 2005 - 5:54 PM

’CExtTabPageContainerOneNoteWnd’ has a strong background color which is behind the tabs. This color mostly does not fit in the layout of the application. How can I change/disable this background? I have allready my own class derived from ’CExtTabPageContainerOneNoteWnd’. If you wish I send you pictures of relating sector.


Thanks!

Technical Support Jul 20, 2005 - 10:49 AM

Yes, some screenshots would be greatly appreciated. We assume you want to replace a vertical gradient background with a horizontal one. In this case, just use a CExtTabPageContainerOneNoteWnd derived class like as follows:

class CMyTabPageContainerOneNoteWnd : public CExtTabPageContainerOneNoteWnd

{

    class CMyTabOneNoteWnd : public CExtTabOneNoteWnd

    {

    public:

        void OnTabWndEraseClientArea(

            CDC & dc,

            CRect & rcClient,

            CRect & rcTabItemsArea,

            CRect & rcTabNearBorderArea,

            DWORD dwOrientation,

            bool bGroupedMode

            )

        {

            ASSERT_VALID( this );

            ASSERT( dc.GetSafeHdc() != NULL );

            rcTabItemsArea;

            bGroupedMode;

 

            g_PaintManager->PaintTabClientArea(

                dc,

                rcClient,

                rcTabItemsArea,

                rcTabNearBorderArea,

                dwOrientation,

                bGroupedMode,

                this

                );

 

            if( ! rcTabNearBorderArea.IsRectEmpty() )

            {
                 // prepare tab border margin rect
                CRect rcTabNearMargin( rcTabNearBorderArea );

                CRect rcColorLine( rcClient );

 

                switch( dwOrientation )

                {

                case __ETWS_ORIENT_TOP:

                    rcTabNearMargin.bottom = rcTabNearMargin.top + 1;

                    rcTabNearMargin.OffsetRect(0,-1);

                    rcColorLine.top = rcTabNearMargin.bottom;

                break;

                case __ETWS_ORIENT_BOTTOM:

                    rcTabNearMargin.top = rcTabNearMargin.bottom - 1;

                    rcTabNearMargin.OffsetRect(0,1);

                    rcColorLine.bottom = rcTabNearMargin.top; 

                break;

                case __ETWS_ORIENT_LEFT:

                    rcTabNearMargin.right = rcTabNearMargin.left + 1;

                    rcTabNearMargin.OffsetRect(-1,0);

                    rcColorLine.left = rcTabNearMargin.right;

                break;

                case __ETWS_ORIENT_RIGHT:

                    rcTabNearMargin.left = rcTabNearMargin.right - 1;

                    rcTabNearMargin.OffsetRect(1,0);

                    rcColorLine.right = rcTabNearMargin.left;

                break;

                default:

                    ASSERT( FALSE );

                break;

                } // switch( dwOrientation )

 

                // paint tab border margin

                dc.FillSolidRect(

                    &rcTabNearMargin,

                    g_PaintManager->GetColor( COLOR_3DSHADOW, this )

                    );

 

                if( dc.GetDeviceCaps( BITSPIXEL ) > 8 )

                {

                    COLORREF clrBkDark;

                    OnTabWndQueryItemColors(

                        SelectionGet(),

                        false,

                        false,

                        NULL,

                        NULL,

                        NULL,

                        &clrBkDark,

                        NULL

                        );

                    dc.FillSolidRect(

                        &rcColorLine,

                        clrBkDark

                        );

                }

                else 

                {

                    dc.FillSolidRect( 

                        &rcColorLine, 

                        g_PaintManager->GetColor(

                            SelectionGet() >= 0

                                ? COLOR_WINDOW

                                : COLOR_3DFACE

                                ,

                            this

                            )

                        );

                }

            } // if( ! rcTabNearBorderArea.IsRectEmpty() )

        }

    };

public:

    virtual CExtTabWnd * OnTabWndGetTabImpl()

    {

        return new CExtTWPC < CMyTabOneNoteWnd >;

    }

};
In addition please open the CExtTabPageContainerOneNoteWnd::PageInsert() method, find the following lines:
CExtTabOneNoteWnd * pWndTab = 

      dynamic_cast < CExtTabOneNoteWnd * > ( m_pWndTab );
and replace them with:
CExtTabOneNoteWnd * pWndTab = 

      DYNAMIC_DOWNCAST( CExtTabOneNoteWnd, m_pWndTab );