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 » Text of the pages added to CExtTabPageContainerOneNoteWnd class overlap each other Collapse All
Subject Author Date
MUKESH GUPTA Feb 14, 2011 - 12:51 AM

We were using ProfUIS version 2.54 and have recently upgraded to the latest version 2.91.I built all the static and dll targets of 2.91 on VS2008.


We have derived our class from CExtTabPageContainerOneNoteWnd & then have overridden OnCreate(LPCREATESTRUCT lpCreateStruct) which has been implemented as :-


int classname::OnCreate(LPCREATESTRUCT lpCreateStruct)

{

 if( CExtTabPageContainerOneNoteWnd::OnCreate(lpCreateStruct) == -1 )

  return -1;


 OrientationSet( __ETWS_ORIENT_LEFT );


 CCreateContext* pContext = NULL;

 if (lpCreateStruct != NULL)

  pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;




 CString strTabname = "Tab One";

 if( ! m_view1->Create(NULL,_T(""),WS_CHILD | WS_VISIBLE,CRect(20,20,1,1), this,ID_VIEW1, pContext))

 {

  ASSERT( FALSE );

  return -1;

 }

 if( ! PageInsert(m_view1->GetSafeHwnd(),strTabname))

 {

  ASSERT( FALSE );

  return -1;

 } 


 

 if( ! m_View2->Create(NULL,_T(""),WS_CHILD | WS_VISIBLE,CRect(30,30,1,1),this,ID_VIEW2, pContext))

 {

  ASSERT( FALSE );

  return -1;

 }

 strTabname  = "Tab Two";

 if( ! PageInsert(m_View2->GetSafeHwnd(),strTabname))

 {

  ASSERT( FALSE );

  return -1;

 }


}

Here, m_view1 & m_view2 are instances of classes derived from CView class


The above code creates tab which are aligned vertically. The problem is that a part of text text of second tab gets hidden under first tab. I have attached screen shot for the same. Please sugguest if I’m missing something here?

MUKESH GUPTA Feb 19, 2011 - 4:20 AM

Thanks. Its working fine now.

MUKESH GUPTA Feb 16, 2011 - 3:20 AM

I was also able to reproduce the same issue using one of the sample applications namely "TabbedBars". I opened TabbedBars_900.vcproj using VS 2008, built the solution & on running, it displays 3 tabs namely  "Tabbed Toolbar Options", "Resizable Bar Options",

"Other Options"
.


With orientation set to __ETWS_ORIENT_LEFT in CChildView::OnCreate( LPCREATESTRUCT lpCreateStruct ) , observed that the issue was reproducible. Also found that with orientation set to __ETWS_ORIENT_TOP, issue was not reproducible. Please let me know if I still need to share the files.

Technical Support Feb 17, 2011 - 2:44 AM

Thank you for providing us with this details. To fix the text positioning issue, please update the source code for the following method:

void CExtTabOneNoteWnd::stat_OnTabWndDrawItemOneNoteImpl(
    CExtTabOneNoteWnd * pWndTabs,
    CDC & dc,
    CRect & rcTabItemsArea,
    LONG nItemIndex,
    TAB_ITEM_INFO * pTii,
    bool bTopLeft,
    bool bHorz,
    bool bSelected,
    bool bCenteredText,
    bool bGroupedMode,
    bool bInGroupActive,
    bool bInvertedVerticalMode,
    const CRect & rcEntireItem,
    CSize sizeTextMeasured,
    CFont * pFont,
    __EXT_MFC_SAFE_LPCTSTR sText,
    CExtCmdIcon * pIcon,
    COLORREF clrForceTabText, // = COLORREF(-1L)
    COLORREF clrForceTabBk1, // = COLORREF(-1L)
    COLORREF clrForceTabBk2 // = COLORREF(-1L)
    )
{
    ASSERT_VALID( pWndTabs );
    ASSERT_VALID( pTii );
    ASSERT( dc.GetSafeHdc() != NULL );
    ASSERT( pFont != NULL );
    ASSERT( pFont->GetSafeHandle() != NULL );
    pWndTabs; rcTabItemsArea; sizeTextMeasured;
CExtCmdIcon * pIconTabItemCloseButton = pWndTabs->OnTabWndQueryItemCloseButtonShape( pTii );
CExtCmdIcon::e_paint_type_t ePaintStateITICB = (CExtCmdIcon::e_paint_type_t) pWndTabs->OnTabWndQueryItemCloseButtonPaintState( pTii );
CRect rcTabItemCloseButton( 0, 0, 0, 0 );
    if( pIconTabItemCloseButton != NULL )
        rcTabItemCloseButton = pTii->CloseButtonRectGet();
bool bEnabled = pTii->EnabledGet();
bool bHover = ( (!pWndTabs->_IsDND()) && pWndTabs->m_nHoverTrackingHitTest == nItemIndex ) ? true : false;
    if( (pTii->GetItemStyle() & __ETWI_CENTERED_TEXT) != 0 )
        bCenteredText = true;
bool bInGroupFirst = false;
    if( bGroupedMode )
    {
        TAB_ITEM_INFO * pTiiStart = pTii->GetInGroupFirst();
        ASSERT_VALID( pTiiStart );
        bInGroupFirst = ( nItemIndex == pWndTabs->ItemGetIndexOf( pTiiStart ) );
    }
bool bFirstVisible = true;
CExtTabWnd::TAB_ITEM_INFO * pTiiWalk = pTii->GetPrev();
    for( ; pTiiWalk != NULL; pTiiWalk = pTiiWalk->GetPrev() )
    {
        if( pTiiWalk->VisibleGet() )
        {
            bFirstVisible = false;
            break;
        }
    }
bool bFirstItem =
        (    bFirstVisible // nItemIndex == 0
        ||    (    bInGroupFirst
            &&    nItemIndex != pWndTabs->SelectionGet()
            )
        );
CRect rcItem( rcEntireItem );
CRect rcItemRgn( rcItem );
POINT arrPointsBorders[11] =
        {    { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
            { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
            { 0, 0 }, { 0, 0 }, { 0, 0 },
        };
POINT arrPointsInnerArea[10] = 
        {    { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
            { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
            { 0, 0 }, { 0, 0 },
        };
POINT arrPointsClipArea[13] =
        {    { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
            { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
            { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 },
            { 0, 0 },
        };
    if( bHorz )
    {
        if( bTopLeft )
        {
            rcItemRgn.InflateRect( nItemIndex == 0 ? 0 : -1, 0, 1, 0 );

            arrPointsBorders[0] = CPoint( rcItemRgn.right,        rcItemRgn.bottom );
            arrPointsBorders[1] = CPoint( rcItemRgn.right,        rcItemRgn.top + 2 );
            arrPointsBorders[2] = CPoint( rcItemRgn.right - 2,    rcItemRgn.top );
            arrPointsBorders[3] = CPoint( rcItemRgn.left + 5,    rcItemRgn.top );
            arrPointsBorders[4] = CPoint( rcItemRgn.left + 4,    rcItemRgn.top + 1 );
            arrPointsBorders[5] = CPoint( rcItemRgn.left + 3,    rcItemRgn.top + 1 );
            arrPointsBorders[6] = CPoint( rcItemRgn.left + 2,    rcItemRgn.top + 2 );
            arrPointsBorders[7] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top + 2 );
            arrPointsBorders[8] = CPoint( rcItemRgn.left,        rcItemRgn.top + 3 );
            if( bSelected || bFirstItem )
            {
                arrPointsBorders[9] = CPoint( rcItemRgn.left - 15, rcItemRgn.bottom - 1 );
                arrPointsBorders[10] = CPoint( rcItemRgn.left - 16, rcItemRgn.bottom - 1 );
            }
            else
            {
                arrPointsBorders[9]= CPoint( rcItemRgn.left, rcItemRgn.bottom - 1 );
                arrPointsBorders[10]= arrPointsBorders[9];
            }
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
                    arrPointsBorders[i].x += 16;
            
            arrPointsInnerArea[0] = CPoint( rcItemRgn.right - 1,    rcItemRgn.bottom );
            arrPointsInnerArea[1] = CPoint( rcItemRgn.right - 1,    rcItemRgn.top + 2 );
            arrPointsInnerArea[2] = CPoint( rcItemRgn.right - 2,    rcItemRgn.top + 1 );
            arrPointsInnerArea[3] = CPoint( rcItemRgn.left + 5,        rcItemRgn.top + 1 );
            arrPointsInnerArea[4] = CPoint( rcItemRgn.left + 4,        rcItemRgn.top + 2 );
            arrPointsInnerArea[5] = CPoint( rcItemRgn.left + 3,        rcItemRgn.top + 2 );
            arrPointsInnerArea[6] = CPoint( rcItemRgn.left + 2,        rcItemRgn.top + 3 );
            arrPointsInnerArea[7] = CPoint( rcItemRgn.left + 1,        rcItemRgn.top + 3 );
            arrPointsInnerArea[8] = CPoint( rcItemRgn.left,            rcItemRgn.top + 4 );
            if( bSelected || bFirstItem )
                arrPointsInnerArea[9] = CPoint( rcItemRgn.left - 14, rcItemRgn.bottom - 1 );
            else
                arrPointsInnerArea[9] = CPoint( rcItemRgn.left, rcItemRgn.bottom - 1 );
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
                    arrPointsInnerArea[i].x += 16;

            arrPointsClipArea[0] = CPoint( rcItemRgn.right - 2,        rcItemRgn.bottom );
            arrPointsClipArea[1] = CPoint( rcItemRgn.right - 2,        rcItemRgn.top + 2 );
            arrPointsClipArea[2] = CPoint( rcItemRgn.left + 5,        rcItemRgn.top + 2 );
            arrPointsClipArea[3] = CPoint( rcItemRgn.left + 4,        rcItemRgn.top + 3 );
            arrPointsClipArea[4] = CPoint( rcItemRgn.left + 3,        rcItemRgn.top + 3 );
            arrPointsClipArea[5] = CPoint( rcItemRgn.left + 2,        rcItemRgn.top + 4 );
            arrPointsClipArea[6] = CPoint( rcItemRgn.left + 1,        rcItemRgn.top + 4 );
            arrPointsClipArea[7] = CPoint( rcItemRgn.left,            rcItemRgn.top + 5 );
            if( bSelected || bFirstItem )
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.left - 14,    rcItemRgn.bottom );
                arrPointsClipArea[9] = CPoint( rcItemRgn.left - 16,    rcItemRgn.bottom );
                arrPointsClipArea[10]= CPoint( rcItemRgn.left - 16,    rcItemRgn.bottom );
                arrPointsClipArea[11]= CPoint( rcItemRgn.right,        rcItemRgn.bottom );
                if( bSelected )
                {
                    arrPointsClipArea[10].y++;
                    arrPointsClipArea[11].y++;
                }
            }
            else
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.left,    rcItemRgn.bottom );
                arrPointsClipArea[11]= CPoint( rcItemRgn.right - 2, rcItemRgn.bottom );
                arrPointsClipArea[10] = arrPointsClipArea[9] = arrPointsClipArea[8];
            }
            arrPointsClipArea[12] = CPoint( rcItemRgn.right, rcItemRgn.bottom - 1 );
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 2 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
                    arrPointsClipArea[i].x += 16;
    
        } // if( bTopLeft )
        else
        {
            rcItemRgn.InflateRect( nItemIndex == 0 ? 0 : -1, 0, 0, 0 );

            arrPointsBorders[0] = CPoint( rcItemRgn.right,        rcItemRgn.top );
            arrPointsBorders[1] = CPoint( rcItemRgn.right,        rcItemRgn.bottom - 3 );
            arrPointsBorders[2] = CPoint( rcItemRgn.right - 3,    rcItemRgn.bottom );
            arrPointsBorders[3] = CPoint( rcItemRgn.left + 5,    rcItemRgn.bottom );
            arrPointsBorders[4] = CPoint( rcItemRgn.left + 4,    rcItemRgn.bottom - 1 );
            arrPointsBorders[5] = CPoint( rcItemRgn.left + 3,    rcItemRgn.bottom - 1 );
            arrPointsBorders[6] = CPoint( rcItemRgn.left + 2,    rcItemRgn.bottom - 2 );
            arrPointsBorders[7] = CPoint( rcItemRgn.left + 1,    rcItemRgn.bottom - 2 );
            arrPointsBorders[8] = CPoint( rcItemRgn.left - 1,    rcItemRgn.bottom - 4 );
            if( bSelected || bFirstItem )
            {
                arrPointsBorders[9] = CPoint( rcItemRgn.left - 16, rcItemRgn.top + 1 );
                arrPointsBorders[10] = CPoint( rcItemRgn.left - 17, rcItemRgn.top + 1 );
            }
            else
            {
                arrPointsBorders[9]= CPoint( rcItemRgn.left - 1, rcItemRgn.top + 1 );
                arrPointsBorders[10]= arrPointsBorders[9];
            }
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
                    arrPointsBorders[i].x += 16;
            
            arrPointsInnerArea[0] = CPoint( rcItemRgn.right - 1,    rcItemRgn.top );
            arrPointsInnerArea[1] = CPoint( rcItemRgn.right - 1,    rcItemRgn.bottom - 3 );
            arrPointsInnerArea[2] = CPoint( rcItemRgn.right - 3,    rcItemRgn.bottom - 1 );
            arrPointsInnerArea[3] = CPoint( rcItemRgn.left + 5,        rcItemRgn.bottom - 1 );
            arrPointsInnerArea[4] = CPoint( rcItemRgn.left + 4,        rcItemRgn.bottom - 2 );
            arrPointsInnerArea[5] = CPoint( rcItemRgn.left + 3,        rcItemRgn.bottom - 2 );
            arrPointsInnerArea[6] = CPoint( rcItemRgn.left + 2,        rcItemRgn.bottom - 3 );
            arrPointsInnerArea[7] = CPoint( rcItemRgn.left + 1,        rcItemRgn.bottom - 3 );
            arrPointsInnerArea[8] = CPoint( rcItemRgn.left - 1,        rcItemRgn.bottom - 5 );
            if( bSelected || bFirstItem )
                arrPointsInnerArea[9] = CPoint( rcItemRgn.left - 14, rcItemRgn.top + 1 );
            else
                arrPointsInnerArea[9] = CPoint( rcItemRgn.left - 1, rcItemRgn.top + 1 );
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
                    arrPointsInnerArea[i].x += 16;

            arrPointsClipArea[0] = CPoint( rcItemRgn.right - 2,        rcItemRgn.top );
            arrPointsClipArea[1] = CPoint( rcItemRgn.right - 2,        rcItemRgn.bottom - 2 );
            arrPointsClipArea[2] = CPoint( rcItemRgn.left + 5,        rcItemRgn.bottom - 2 );
            arrPointsClipArea[3] = CPoint( rcItemRgn.left + 4,        rcItemRgn.bottom - 3 );
            arrPointsClipArea[4] = CPoint( rcItemRgn.left + 3,        rcItemRgn.bottom - 3 );
            arrPointsClipArea[5] = CPoint( rcItemRgn.left + 2,        rcItemRgn.bottom - 4 );
            arrPointsClipArea[6] = CPoint( rcItemRgn.left + 1,        rcItemRgn.bottom - 4 );
            arrPointsClipArea[7] = CPoint( rcItemRgn.left - 1,        rcItemRgn.bottom - 6 );
            if( bSelected || bFirstItem )
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.left - 15,    rcItemRgn.top );
                arrPointsClipArea[9] = CPoint( rcItemRgn.left - 16,    rcItemRgn.top + 1 );
                arrPointsClipArea[10]= CPoint( rcItemRgn.left - 16,    rcItemRgn.top + 1 );
                arrPointsClipArea[11]= CPoint( rcItemRgn.right,        rcItemRgn.top + 1 );
                if( bSelected )
                {
                    arrPointsClipArea[10].y -= 1;
                    arrPointsClipArea[11].y -= 1;
                }
            }
            else
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.left - 1, rcItemRgn.top + 1 );
                arrPointsClipArea[11]= CPoint( rcItemRgn.right, rcItemRgn.top + 1 );
                arrPointsClipArea[10] = arrPointsClipArea[9] = arrPointsClipArea[8];
            }
            arrPointsClipArea[12] = CPoint( rcItemRgn.right, rcItemRgn.top + 1 );
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 2 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
                    arrPointsClipArea[i].x += 16;

        } // else if( bTopLeft )
    } // if( bHorz )
    else
    {
        if( bTopLeft )
        {
            rcItemRgn.InflateRect( 0, nItemIndex == 0 ? 0 : -1, 0, 1 );

            arrPointsBorders[0] = CPoint( rcItemRgn.right,        rcItemRgn.bottom );
            arrPointsBorders[1] = CPoint( rcItemRgn.left + 3,    rcItemRgn.bottom );
            arrPointsBorders[2] = CPoint( rcItemRgn.left,        rcItemRgn.bottom - 3 );
            arrPointsBorders[3] = CPoint( rcItemRgn.left,        rcItemRgn.top + 5 );
            arrPointsBorders[4] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top + 4 );
            arrPointsBorders[5] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top + 3 );
            arrPointsBorders[6] = CPoint( rcItemRgn.left + 2,    rcItemRgn.top + 2 );
            arrPointsBorders[7] = CPoint( rcItemRgn.left + 2,    rcItemRgn.top + 1 );
            arrPointsBorders[8] = CPoint( rcItemRgn.left + 3,    rcItemRgn.top );
            if( bSelected || bFirstItem )
            {
                arrPointsBorders[9] = CPoint( rcItemRgn.right - 1, rcItemRgn.top - 16 );
                arrPointsBorders[10] = CPoint( rcItemRgn.right - 1, rcItemRgn.top - 17 );
            }
            else
            {
                arrPointsBorders[9] = CPoint( rcItemRgn.left + 3, rcItemRgn.top );
                arrPointsBorders[10]= CPoint( rcItemRgn.right, rcItemRgn.top );
            }
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
                    arrPointsBorders[i].y += 16;
            
            arrPointsInnerArea[0] = CPoint( rcItemRgn.right,    rcItemRgn.bottom - 1 );
            arrPointsInnerArea[1] = CPoint( rcItemRgn.left + 3,    rcItemRgn.bottom - 1 );
            arrPointsInnerArea[2] = CPoint( rcItemRgn.left + 1,    rcItemRgn.bottom - 3 );
            arrPointsInnerArea[3] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top + 5 );
            arrPointsInnerArea[4] = CPoint( rcItemRgn.left + 2,    rcItemRgn.top + 4 );
            arrPointsInnerArea[5] = CPoint( rcItemRgn.left + 2,    rcItemRgn.top + 3);
            arrPointsInnerArea[6] = CPoint( rcItemRgn.left + 3,    rcItemRgn.top + 2 );
            arrPointsInnerArea[7] = CPoint( rcItemRgn.left + 3,    rcItemRgn.top + 1 );
            arrPointsInnerArea[8] = CPoint( rcItemRgn.left + 4,    rcItemRgn.top );
            if( bSelected || bFirstItem )
                arrPointsInnerArea[9] = CPoint( rcItemRgn.right, rcItemRgn.top - 15 );
            else
                arrPointsInnerArea[9] = CPoint( rcItemRgn.right, rcItemRgn.top );
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
                    arrPointsInnerArea[i].y += 16;

            arrPointsClipArea[0] = CPoint( rcItemRgn.right,        rcItemRgn.bottom - 2 );
            arrPointsClipArea[1] = CPoint( rcItemRgn.left + 3,    rcItemRgn.bottom - 2 );
            arrPointsClipArea[2] = CPoint( rcItemRgn.left + 2,    rcItemRgn.bottom - 3 );
            arrPointsClipArea[3] = CPoint( rcItemRgn.left + 2,    rcItemRgn.top + 5 );
            arrPointsClipArea[4] = CPoint( rcItemRgn.left + 3,    rcItemRgn.top + 4 );
            arrPointsClipArea[5] = CPoint( rcItemRgn.left + 3,    rcItemRgn.top + 3);
            arrPointsClipArea[6] = CPoint( rcItemRgn.left + 4,    rcItemRgn.top + 2 );
            arrPointsClipArea[7] = CPoint( rcItemRgn.left + 4,    rcItemRgn.top + 1 );
            if( bSelected || bFirstItem )
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.right,        rcItemRgn.top - 15 );
                arrPointsClipArea[9] = CPoint( rcItemRgn.right,        rcItemRgn.top - 16 );
                arrPointsClipArea[10]= CPoint( rcItemRgn.right,        rcItemRgn.top - 16 );
                arrPointsClipArea[11]= CPoint( rcItemRgn.right - 1,    rcItemRgn.bottom );
                if( bSelected )
                {
                    arrPointsClipArea[10].x += 1;
                    arrPointsClipArea[11].x += 1;
                }
                  arrPointsClipArea[12]= arrPointsClipArea[11];
            }
            else
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.left + 5,    rcItemRgn.top );
                arrPointsClipArea[9] = CPoint( rcItemRgn.right,        rcItemRgn.top );
                arrPointsClipArea[10]= CPoint( rcItemRgn.right,        rcItemRgn.bottom );
                arrPointsClipArea[12]= 
                    arrPointsClipArea[11] = 
                    arrPointsClipArea[10];
            }
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
                    arrPointsClipArea[i].y += 16;

        } // if( bTopLeft )
        else
        {
            //rcItemRgn.InflateRect( 0, nItemIndex == 0 ? 0 : -1, 0, 0 );

            arrPointsBorders[0] = CPoint( rcItemRgn.left,        rcItemRgn.bottom );
            arrPointsBorders[1] = CPoint( rcItemRgn.right - 3,    rcItemRgn.bottom );
            arrPointsBorders[2] = CPoint( rcItemRgn.right,        rcItemRgn.bottom - 3 );
            arrPointsBorders[3] = CPoint( rcItemRgn.right,        rcItemRgn.top + 5 );
            arrPointsBorders[4] = CPoint( rcItemRgn.right - 1,    rcItemRgn.top + 4 );
            arrPointsBorders[5] = CPoint( rcItemRgn.right - 1,    rcItemRgn.top + 3 );
            arrPointsBorders[6] = CPoint( rcItemRgn.right - 2,    rcItemRgn.top + 2 );
            arrPointsBorders[7] = CPoint( rcItemRgn.right - 2,    rcItemRgn.top + 1 );
            arrPointsBorders[8] = CPoint( rcItemRgn.right - 3,    rcItemRgn.top );
            if( bSelected || bFirstItem )
            {
                arrPointsBorders[9] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top - 16 );
                arrPointsBorders[10]= CPoint( rcItemRgn.left + 1,    rcItemRgn.top - 17 );
            }
            else
            {
                arrPointsBorders[9] = CPoint( rcItemRgn.right - 3, rcItemRgn.top );
                arrPointsBorders[10]= CPoint( rcItemRgn.left, rcItemRgn.top );
            }
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsBorders)/sizeof(arrPointsBorders[0]); i++ )
                    arrPointsBorders[i].y += 16;

            arrPointsInnerArea[0] = CPoint( rcItemRgn.left,            rcItemRgn.bottom - 1 );
            arrPointsInnerArea[1] = CPoint( rcItemRgn.right - 3,    rcItemRgn.bottom - 1 );
            arrPointsInnerArea[2] = CPoint( rcItemRgn.right - 1,    rcItemRgn.bottom - 3 );
            arrPointsInnerArea[3] = CPoint( rcItemRgn.right - 1,    rcItemRgn.top + 5 );
            arrPointsInnerArea[4] = CPoint( rcItemRgn.right - 2,    rcItemRgn.top + 4 );
            arrPointsInnerArea[5] = CPoint( rcItemRgn.right - 2,    rcItemRgn.top + 3);
            arrPointsInnerArea[6] = CPoint( rcItemRgn.right - 3,    rcItemRgn.top + 2 );
            arrPointsInnerArea[7] = CPoint( rcItemRgn.right - 3,    rcItemRgn.top + 1 );
            arrPointsInnerArea[8] = CPoint( rcItemRgn.right - 4,    rcItemRgn.top );
            if( bSelected || bFirstItem )
                arrPointsInnerArea[9] = CPoint( rcItemRgn.left + 1, rcItemRgn.top - 15 );
            else
                arrPointsInnerArea[9] = CPoint( rcItemRgn.left + 1, rcItemRgn.top );
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsInnerArea)/sizeof(arrPointsInnerArea[0]); i++ )
                    arrPointsInnerArea[i].y += 16;

            arrPointsClipArea[0] = CPoint( rcItemRgn.left + 1,    rcItemRgn.bottom - 2 );
            arrPointsClipArea[1] = CPoint( rcItemRgn.right - 3,    rcItemRgn.bottom - 2 );
            arrPointsClipArea[2] = CPoint( rcItemRgn.right - 2,    rcItemRgn.bottom - 3 );
            arrPointsClipArea[3] = CPoint( rcItemRgn.right - 2,    rcItemRgn.top + 5 );
            arrPointsClipArea[4] = CPoint( rcItemRgn.right - 3,    rcItemRgn.top + 4 );
            arrPointsClipArea[5] = CPoint( rcItemRgn.right - 3,    rcItemRgn.top + 3);
            arrPointsClipArea[6] = CPoint( rcItemRgn.right - 4,    rcItemRgn.top + 2 );
            arrPointsClipArea[7] = CPoint( rcItemRgn.right - 4,    rcItemRgn.top + 1 );

            if( bSelected || bFirstItem )
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top - 14 );
                arrPointsClipArea[9] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top - 15 );
                arrPointsClipArea[10]= CPoint( rcItemRgn.left + 1,    rcItemRgn.top - 15 );
                arrPointsClipArea[11]= CPoint( rcItemRgn.left + 1,    rcItemRgn.bottom );
                if( bSelected )
                {
                    arrPointsClipArea[10].x -= 1;
                    arrPointsClipArea[11].x -= 1;
                }
                  arrPointsClipArea[12]= arrPointsClipArea[11];
            }
            else
            {
                arrPointsClipArea[8] = CPoint( rcItemRgn.right - 5,    rcItemRgn.top );
                arrPointsClipArea[9] = CPoint( rcItemRgn.left + 1,    rcItemRgn.top );
                arrPointsClipArea[10]= CPoint( rcItemRgn.left + 1,  rcItemRgn.bottom );
                arrPointsClipArea[12]= 
                    arrPointsClipArea[11] = 
                    arrPointsClipArea[10];
            }
            if( bFirstVisible /*nItemIndex == 0*/ )
                for( int i = 3 ; i < sizeof(arrPointsClipArea)/sizeof(arrPointsClipArea[0]) - 3; i++ )
                    arrPointsClipArea[i].y += 16;

        } // else if( bTopLeft )

    } // else if( bHorz )

COLORREF clrBorderLight = (COLORREF)(-1L);
COLORREF clrBorderDark = (COLORREF)(-1L);
COLORREF clrBkLight = (COLORREF)(-1L);
COLORREF clrBkDark = (COLORREF)(-1L);
COLORREF clrText = (COLORREF)(-1L);

    pWndTabs->OnTabWndQueryItemColors(
        nItemIndex,
        bSelected,
        bHover,
        bEnabled,
        &clrBorderLight,
        &clrBorderDark,
        &clrBkLight,
        &clrBkDark,
        &clrText
        );
    if( clrForceTabText != COLORREF(-1L) )
        clrText = clrForceTabText;
    if( clrForceTabBk1 != COLORREF(-1L) )
        clrBkLight = clrForceTabBk1;
    if( clrForceTabBk2 != COLORREF(-1L) )
        clrBkDark = clrForceTabBk2;

// draw item border 
CBrush brushBorders( clrBorderDark );
CBrush brushBordersInnerArea( clrBorderLight );
CRgn rgnBorders, rgnBordersInnerArea, rgnClipArea;
    VERIFY( rgnBorders.CreatePolygonRgn( arrPointsBorders, 11, ALTERNATE ) );
    VERIFY( rgnBordersInnerArea.CreatePolygonRgn( arrPointsInnerArea, 10, ALTERNATE ) );
    VERIFY( rgnClipArea.CreatePolygonRgn( arrPointsClipArea, 13, ALTERNATE ) );
    dc.FrameRgn( &rgnBorders, &brushBorders, 1, 1 );
    dc.FrameRgn( &rgnBordersInnerArea, &brushBordersInnerArea, 1, 1 );

    // fill item background 
CRect rcFill( rcItemRgn );
    rcFill.InflateRect(
        bHorz ? 20 :  0,
        bHorz ?  0 : 20,
        bHorz ? 20 :  0,
        bHorz ?  0 : 20
        );
    if( bTopLeft )
        rcFill.InflateRect(
            0,
            0,
            bHorz ? 0 : 1,
            bHorz ? 1 : 0
            );

    dc.SelectClipRgn( &rgnClipArea, RGN_AND );
    if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
    {
        CExtPaintManager::stat_PaintGradientRect(
            dc,
            &rcFill,
            bHorz 
                ? ( bTopLeft ? clrBkDark : clrBkLight ) 
                : ( bTopLeft ? clrBkLight : clrBkDark ),
            bHorz 
                ? ( bTopLeft ? clrBkLight : clrBkDark ) 
                : ( bTopLeft ? clrBkDark : clrBkLight ),
            bHorz
        );
    } // if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )
    else 
    {
        dc.FillSolidRect( 
            &rcFill, 
            bSelected 
                ? pWndTabs->PmBridge_GetPM()->GetColor( COLOR_WINDOW, pWndTabs )
                : pWndTabs->PmBridge_GetPM()->GetColor( COLOR_3DFACE, pWndTabs )
            );
    } // else from if( ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) > 8 )

    rcItem.DeflateRect(
        bHorz 
            ? __EXTTAB_ONENOTE_INDENT_LEFT 
            : ( bTopLeft ? __EXTTAB_ONENOTE_INDENT_TOP * 2 : __EXTTAB_ONENOTE_INDENT_BOTTOM ),
        bHorz 
            ? ( bTopLeft ? __EXTTAB_ONENOTE_INDENT_TOP : 0 ) 
            : __EXTTAB_ONENOTE_INDENT_LEFT,
        bHorz 
            ? __EXTTAB_ONENOTE_INDENT_RIGHT 
            : 0,
        bHorz 
            ? 0 
            : __EXTTAB_ONENOTE_INDENT_RIGHT
        );

    // first item indent
    if( bFirstVisible /*nItemIndex == 0*/ )
        rcItem.DeflateRect(
            bHorz ? 16 : 0,
            (!bHorz) ? 16 : 0,
            0,
            0
            );

bool bDrawIcon =
        (    pIcon != NULL 
        &&    (!pIcon->IsEmpty()) 
        &&    (pWndTabs->GetTabWndStyle()&__ETWS_HIDE_ICONS) == 0 
        ) ? true : false;

    // if tab has no icons - increase left indent
    if( (!bDrawIcon) && (pWndTabs->GetTabWndStyle()&__ETWS_CENTERED_TEXT) == 0 )
        rcItem.DeflateRect(
            bHorz ? 4 : 0,
            0,
            0,
            0
            );

CSize _sizeIcon( 0, 0 );
    if( bDrawIcon )
    {
        _sizeIcon = pIcon->GetSize();
        ASSERT( _sizeIcon.cx > 0 && _sizeIcon.cy > 0 );
    }
CRect rcItemForIcon( rcItem );
    if(        bDrawIcon
        &&    _sizeIcon.cx > 0
        &&    _sizeIcon.cy > 0
        )
    {
        rcItemForIcon.right = rcItemForIcon.left + _sizeIcon.cx;
        rcItemForIcon.bottom = rcItemForIcon.top + _sizeIcon.cy;
        rcItemForIcon.OffsetRect(
            bHorz ? 0 : ((rcItem.Width() - _sizeIcon.cx) / 2),
            bHorz ? ((rcItem.Height() - _sizeIcon.cy) / 2) : 0
            );
        if( rcItemForIcon.left < rcItem.left )
            rcItemForIcon.left = rcItem.left;
        if( rcItemForIcon.right > rcItem.right )
            rcItemForIcon.right = rcItem.right;
        if( rcItemForIcon.top < rcItem.top )
            rcItemForIcon.top = rcItem.top;
        if( rcItemForIcon.bottom > rcItem.bottom )
            rcItemForIcon.bottom = rcItem.bottom;
    }

CExtSafeString sItemText( (sText == NULL) ? _T("") : sText );

CRect rcText(
        rcItem.left
            +    (    bHorz
                    ? (_sizeIcon.cx + ( ( _sizeIcon.cx > 0 ) ? 2*__EXTTAB_MARGIN_ICON2TEXT_X : 0 ) )
                    : 0
                ),
        rcItem.top 
            +    (    bHorz
                    ? 0
                    : ( _sizeIcon.cy + ( ( _sizeIcon.cy > 0 ) ? __EXTTAB_MARGIN_ICON2TEXT_Y : 0 ) )
                ),
        rcItem.right,
        rcItem.bottom
        );
    if( ! bHorz )
    {
        if( pIconTabItemCloseButton != NULL )
            rcText.bottom = min( rcText.bottom, rcTabItemCloseButton.top );
    } // if( !bHorz )
    else
    {
        if( pIconTabItemCloseButton != NULL )
            rcText.right = min( rcText.right, rcTabItemCloseButton.left );
    }

bool bDrawText = ( ( ! sItemText.IsEmpty() ) && rcText.Width() > 6 && rcText.Height() > 6 ) ? true : false;

INT nIconAlignment = CExtPaintManager::__ALIGN_HORIZ_LEFT | CExtPaintManager::__ALIGN_VERT_TOP;
    if( ( ! bDrawText) && ( ! ( bGroupedMode && ( ! bInGroupActive ) ) ) )
    {
        if( bCenteredText )
        {
            nIconAlignment = CExtPaintManager::__ALIGN_HORIZ_CENTER|CExtPaintManager::__ALIGN_VERT_CENTER;
            rcItemForIcon = rcItem;
        }
        else
            rcItemForIcon.OffsetRect(
                bHorz ? ( rcItem.Width() - _sizeIcon.cx ) / 2 : 0,
                bHorz ? 0 : ( rcItem.Height() - _sizeIcon.cy ) / 2
                );
    }

    if( bDrawIcon )
    {
        if(        (     bHorz   && rcItemForIcon.Width()  >= _sizeIcon.cx )
            ||    ( ( ! bHorz ) && rcItemForIcon.Height() >= _sizeIcon.cy )
            )
        {
            rcItemForIcon.OffsetRect(
                bHorz ? 4 : 0,
                bHorz ? 0 : 4
                );
            pWndTabs->PmBridge_GetPM()->PaintIcon(
                dc,
                bHorz,
                pIcon,
                rcItemForIcon,
                false,
                bEnabled,
                false,
                nIconAlignment
                );
        }
    }
    else
    {
        if( ! bHorz )
        {
            if( bDrawText )
                rcText.OffsetRect( 0, 4 );
        }
    }

    if( bDrawText )
    { // if we have sense to paint text on tab item
        ASSERT( pFont != NULL );
        ASSERT( pFont->GetSafeHandle() != NULL );
        bool bNoPrefix = ( ( pWndTabs->GetTabWndStyleEx() & __ETWS_EX_NO_PREFIX ) != 0 ) ? true : false;
        COLORREF clrOldText = dc.SetTextColor( clrText );
        INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
        CFont * pOldFont = dc.SelectObject( pFont );
        UINT nFormat = DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS;
        CExtRichContentLayout::e_layout_orientation_t eLO = CExtRichContentLayout::__ELOT_NORMAL;
        if( ! bHorz )
            eLO = bInvertedVerticalMode ? CExtRichContentLayout::__ELOT_270_CW : CExtRichContentLayout::__ELOT_90_CW;
        if( bCenteredText )
            nFormat |= DT_CENTER;
        else
            nFormat |= DT_LEFT;
        if( bNoPrefix )
            nFormat |= DT_NOPREFIX;
        CExtRichContentLayout::stat_DrawText(
            CExtRichContentLayout::__ELFMT_AUTO_DETECT, eLO,
            dc.m_hDC, LPCTSTR(sItemText), sItemText.GetLength(), rcText, nFormat, 0
            );
        dc.SelectObject( pOldFont );
        dc.SetBkMode( nOldBkMode );
        dc.SetTextColor( clrOldText );
    } // if we have sense to paint text on tab item
    
    if( pIconTabItemCloseButton != NULL )
    {
        ASSERT( ! pIconTabItemCloseButton->IsEmpty() );
        if( dc.RectVisible( &rcTabItemCloseButton ) )
        {
            CRect _rcTabItemCloseButton = rcTabItemCloseButton;
            if( bHorz )
            {
                if( bTopLeft )
                    _rcTabItemCloseButton.OffsetRect( 0, 1 );
            }
            else
            {
                if( bTopLeft )
                    _rcTabItemCloseButton.OffsetRect( 1, 0 );
            }
            pIconTabItemCloseButton->Paint(
                g_PaintManager.GetPM(),
                dc.m_hDC,
                _rcTabItemCloseButton,
                ePaintStateITICB
                );
        }
    } // if( pIconTabItemCloseButton != NULL )

    dc.SelectClipRgn( NULL );
}

MUKESH GUPTA Feb 14, 2011 - 11:03 PM

This problem occurs if the tabs are vertically aligned. With default orientation, its displaying all the tabs at the bottom & the problem doesnot occur  when alignment is at bottom. Please suggest.

Technical Support Feb 15, 2011 - 9:34 AM

We cannot reproduce this problem. Could you create a simple test project demonstrating this problem and send it to us at support@prof-uis.com?

MUKESH GUPTA Feb 14, 2011 - 5:56 AM

I tried calling OrientationSet( __ETWS_ORIENT_LEFT ); at the end but it didn’t work. The text of the second tab ("Tab Two") still overlaps with the first tab.

Technical Support Feb 14, 2011 - 5:18 AM

Please try invoking the OrientationSet( __ETWS_ORIENT_LEFT ); code at the bottom of the OnCreate() method.