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 » Combo box painting problem in 2.83 Collapse All
Subject Author Date
Offer Har Jun 4, 2008 - 2:39 PM

There is a problem in the way you paint combo-box in 2.83, which is related to my problem of some extra line to the left of the drop arrow.


As you can see below, in a standard combo-box, when it’s in focus, the blue fill color does not go all the way to the right as it should:



This is exactly the place where in ownerdraw combo I get an extra line.


I think that if you’ll fix this problem, it will fix my extra line problem.


Thanks,


Ron.

Offer Har Jun 16, 2008 - 10:23 AM

Any ideas how to fix this problem? Did you look at it?

Technical Support Jun 17, 2008 - 3:49 AM

We cannot agree that it is a bug. The empty space together with drop down button occupies the space which is required for painting standard system drop-down button and we cannot decrease its width. It is system-controlled. So what we have to do is to paint our button, which has the a smaller width, and then the rest area fill with thebackground color. We don’t see any painting problems in any of our samples.

Offer Har Jun 17, 2008 - 5:19 AM

I’m sorry, but you cannot dismiss this by saying this is not a bug, here is a combo from visual studio 2005:



You can see clearly that the spaces on all sides are even, as opposed to your implementation which yields uneven borders:



The extra line bug I reported is clearly there, and I will send you a sample project with it later, and if you will look it falls exactly into the same space of un-even edges of the combo:


Technical Support Jul 8, 2008 - 7:10 AM

We figured out what the problem was. It occurred only when your application didn’t use the XP themes manifest.

To fix the problem, please update the following method and recompile the library:

void CExtPaintManagerOffice2007_Impl::PaintComboFrame(
            CDC & dc,
            CExtPaintManager::PAINTCOMBOFRAMEDATA & _pcfd
            )
{
            ASSERT_VALID( this );
            ASSERT( dc.GetSafeHdc() != NULL );

            if( IsHighContrast() )
            {
                        CExtPaintManagerXP::PaintComboFrame(
                                    dc,
                                    _pcfd
                                    );
                        return;
            }

            if(                      _pcfd.m_pHelperSrc != NULL
                        &&        _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) )
                        &&        ( ((CExtPopupMenuWnd*)_pcfd.m_pHelperSrc)->TrackFlagsGet() & TPMX_RIBBON_MODE ) == 0
                        )
            {
                        CExtPaintManagerOffice2003::PaintComboFrame( dc, _pcfd );
                        return;
            }

CExtComboBoxBase * pWndCombo = NULL;
            if(                      _pcfd.m_pHelperSrc != NULL 
                        &&        _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS( CExtComboBoxBase ) )
                        )
            {
                        pWndCombo = STATIC_DOWNCAST( CExtComboBoxBase, _pcfd.m_pHelperSrc );
                        ASSERT_VALID( pWndCombo );
            }

            if(                      m_bmpArrComboBoxDropDown.IsEmpty()
                        ||           _pcfd.m_pHelperSrc == NULL
                        ||           _pcfd.m_clrForceNABorder != COLORREF(-1L)
                        ||           _pcfd.m_clrForceNAContent != COLORREF(-1L)
                        ||           _pcfd.m_clrForceActiveOuterBorder != COLORREF(-1L)
                        ||           (!          (           _pcfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CComboBox))
                                                ||           _pcfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtBarButton))
                                                ||           _pcfd.m_pHelperSrc->IsKindOf(RUNTIME_CLASS(CExtPopupMenuWnd))
                                                )
                                    )
                        ||           (! GetCb2DbTransparentMode(_pcfd.m_pHelperSrc) )
                        ||           ::GetDeviceCaps( dc.m_hDC, BITSPIXEL ) <= 8
                        )
            {
                        CExtPaintManagerOffice2003::PaintComboFrame( dc, _pcfd );
                        if( (!_pcfd.m_bEnabled) && pWndCombo != NULL )
                        {
                                    ASSERT_VALID( pWndCombo );
                                    CRect rcClip( _pcfd.m_rcClient );
                                    rcClip.DeflateRect(1,1);
                                    dc.ExcludeClipRect( &rcClip );
                                    CExtPaintManagerOffice2003::PaintDockerBkgnd( true, dc, pWndCombo );
                                    dc.SelectClipRgn( NULL );
                        }
                        return;
            }
bool bPopupMenuComboFieldMode = false;
            if(                      _pcfd.m_pHelperSrc != NULL
                        &&        _pcfd.m_pHelperSrc->IsKindOf( RUNTIME_CLASS(CExtPopupMenuWnd) )
                        )
                        bPopupMenuComboFieldMode = true;

INT nDD = GetDropDownButtonWidth( _pcfd.m_pHelperSrc, _pcfd.m_lParam );
CRect rcClient( _pcfd.m_rcClient );
CRect rcEraser( rcClient );
            if( ! bPopupMenuComboFieldMode )
                        rcEraser.DeflateRect(1,1);
CRect rcHoverFrame( rcEraser );
CRect rcDDButton( rcEraser );
            if( _pcfd.m_bRightText )
                        rcDDButton.right = rcDDButton.left + nDD;
            else
                        rcDDButton.left = rcDDButton.right - nDD;
            if( bPopupMenuComboFieldMode )
            {
                        rcDDButton.DeflateRect( 1, 1 );
                        if( _pcfd.m_bRightText )
                                    rcDDButton.right -= 2;
                        else
                                    rcDDButton.left += 2;
            }
CRect rcClientItem( rcEraser );
            rcClientItem.DeflateRect( 1, 1, 3, 1 );
            if( _pcfd.m_bRightText )
                        rcClientItem.left += rcDDButton.Width();
            else
                        rcClientItem.right -= rcDDButton.Width();
            if( bPopupMenuComboFieldMode )
                        rcClientItem.InflateRect(1,1);

CRgn rgnClip, rgnClientItem;
            if(                      (! bPopupMenuComboFieldMode )
                        &&        rgnClip.CreateRectRgnIndirect(&rcClient)
                        &&        rgnClientItem.CreateRectRgnIndirect(&rcClientItem)
                        &&        rgnClip.CombineRgn(
                                                &rgnClip,
                                                &rgnClientItem, 
                                                RGN_DIFF
                                                ) != ERROR
                        )
                        dc.SelectClipRgn( &rgnClip );

            if( pWndCombo != NULL )
            {
                        ASSERT_VALID( pWndCombo );
                        if( ! CExtPaintManagerOffice2003::PaintDockerBkgnd( true, dc, pWndCombo ) )
                        {
                                    if( rgnClip.GetSafeHandle() != NULL )
                                                dc.SelectClipRgn( NULL );
                                    CExtPaintManagerXP::PaintComboFrame( dc, _pcfd );
                                    return;
                        }
            } // if( pWndCombo != NULL )

COLORREF clrWindow = COLORREF(-1L);
            if( pWndCombo != NULL )
                        clrWindow = pWndCombo->GetBkColor();
            if( clrWindow == COLORREF(-1L) )
            {
                        COLORREF clrSysBk =
                                    GetColor( 
                                                _pcfd.m_bEnabled ? COLOR_WINDOW : COLOR_3DFACE,
                                                _pcfd.m_pHelperSrc, 
                                                _pcfd.m_lParam 
                                                );
                        clrWindow = clrSysBk;
            }

            if( ! bPopupMenuComboFieldMode )
            {
                        dc.Draw3dRect( rcEraser, clrWindow, clrWindow );

                        if( _pcfd.m_bRightText )
                                    rcEraser.left += nDD;
                        else
                                    rcEraser.right -= nDD;

                        INT nLeftDX = _pcfd.m_bRightText ? 1 : 0;
                        INT nRightDX = _pcfd.m_bRightText ? 0 : 1;

                        rcEraser.DeflateRect( _pcfd.m_bRightText ? -1 : 0, 1, _pcfd.m_bRightText ? 0 : -1, 1 );
                        dc.Draw3dRect( rcEraser, clrWindow, clrWindow );
 
                        rcEraser.DeflateRect( 1, 0, 1, 0 );
                        dc.Draw3dRect( rcEraser, clrWindow, clrWindow );

                        rcEraser.DeflateRect( nLeftDX, 0, nRightDX, 0 );
                        dc.Draw3dRect( rcEraser, clrWindow, clrWindow );

                        rcEraser.DeflateRect( nLeftDX, 0, nRightDX, 0 );
                        dc.Draw3dRect( rcEraser, clrWindow, clrWindow );
            }
            
// normal=0, hover=1, pressed=2, disabled=3
int nIdx = 3;
            if( _pcfd.m_bEnabled )
            {
                        if( _pcfd.m_bPushed )
                                    nIdx = 2;
                        else if( _pcfd.m_bHover )
                                    nIdx = 1;
                        else
                                    nIdx = 0;
            } // if( _pcfd.m_bEnabled )
CRect rcSrc( 0, 0, m_sizeComboBoxDropDown.cx, m_sizeComboBoxDropDown.cy );
            rcSrc.OffsetRect( 0, m_sizeComboBoxDropDown.cy * nIdx );
            m_bmpArrComboBoxDropDown.AlphaBlendSkinParts(
                        dc.m_hDC,
                        rcDDButton,
                        rcSrc,
                        m_rcPaddingComboBoxDropDown,
                        CExtBitmap::__EDM_STRETCH,
                        true
                        );
COLORREF clrBorder = m_arrClrComboBoxBorder[nIdx];
            dc.Draw3dRect( rcHoverFrame, clrBorder, clrBorder );
            if(                      (! bPopupMenuComboFieldMode )
                        &&        rgnClip.GetSafeHandle() != NULL
                        )
                        dc.SelectClipRgn( NULL );
}
Thank you.