Professional UI Solutions
Site Map   /  Register


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 » BUG: ownerdraw CExtCombox Collapse All
Subject Author Date
Ulrich Heinicke Jan 6, 2008 - 4:58 AM

i used some function from the ultimate toolbox (which is now open source and can be downloaded from to rewrite the openfile-dialog. For the combobox you must set the flag to CBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWFIXED. The problem is that the combobox will draw like
instead of
when to mouse move the first time over the control.
You can see this behaviour when you execute the testprogam (Prof-UIS 2.82 and VS 2008).
How can i solve this problem?

Technical Support Jan 11, 2008 - 8:30 AM

Yes, this is an appropriate solution.

Ulrich Heinicke Jan 10, 2008 - 5:00 AM

To only remove the WM_PAINT handler from COXComboPickerCtrl will be draw the control not like
But i find a way to solve that problem, i overwrite into the COXComboPickerCtrl the function _OnDrawComboImpl and remove the WM_PAINT handler.
Here is the overwrite function:
void COXComboPickerCtrl::_OnDrawComboImpl(bool bPressed, bool bHover, CDC * pDC)
    bool bCallReleaseDC = false;
    if( pDC == NULL )
        pDC = GetDC();
        ASSERT( pDC != NULL );
        bCallReleaseDC = true;

    CRect rectClient;

    CBrush BkBrush (GetSysColor (COLOR_WINDOW));

    pDC->FillRect (&rectClient, &BkBrush);

    // draw dropdown button
    CRect rectDropdownButton=GetDropdownButtonRect();

    HFONT hFont = OnQueryFont();
    if( ! PmBridge_GetPM()->AdjustControlFont(
        LOGFONT _lf;
        ::memset( &_lf, 0, sizeof(LOGFONT) );
        ::GetObject( (HGDIOBJ)hFont, sizeof(LOGFONT), (LPVOID) &_lf );
        _lf.lfWeight =
            (_lf.lfWeight > FW_BOLD)
            ? _lf.lfWeight
            : FW_BOLD;
        hFont = ::CreateFontIndirect( &_lf );
    ASSERT( hFont != NULL );
    CFont _fontDestructor;
    _fontDestructor.Attach( hFont );

    CExtPaintManager::PAINTPUSHBUTTONDATA _ppbd(

    PmBridge_GetPM()->PaintPushButton( *pDC, _ppbd );

    CRect rcDDButtonGlyph( rectDropdownButton );
    //    if( m_bPushed )

    // paint arrow down
    CExtPaintManager::glyph_t * pGlyph =
        CExtPaintManager::g_DockingCaptionGlyphs[ CExtPaintManager::__DCBT_ARROW_DOWN ];
    ASSERT( pGlyph != NULL );
    COLORREF ColorValues[2] =
            ::GetSysColor( COLOR_BTNTEXT )

    // draw border

    // adjust for dropdown button
    // do default painting
    DRAWITEMSTRUCT dis={ sizeof(&dis) };
    dis.itemState=((::GetFocus()==GetSafeHwnd() && !GetDroppedState()) ? ODS_FOCUS : 0);

    if( bCallReleaseDC )
        ReleaseDC( pDC );
Now it’s work ok.

Technical Support Jan 10, 2008 - 2:58 AM

You derived your class COXComboPickerCtrl from CExtComboBox. The latter paints its content itself. So you should remove the WM_PAINT handler from COXComboPickerCtrl.

Ulrich Heinicke Jan 9, 2008 - 10:22 AM

Sorry, the correct link of the source i

Ulrich Heinicke Jan 9, 2008 - 10:21 AM

you have misunderstand me. I don’t subclass any dialog, i create a new one with some classes from the ultimate toolbox. Look at the screenshot of the testprogram
You can look also into the source of the testprogram http://www.ibh-software.rg/shellcontrols.rar

Technical Support Jan 9, 2008 - 6:34 AM

Actually the combo box on the File Dialog is an extended version of the simple combo box control which provides support for image lists (CComboBoxEx). So it is incorrect to subclass it with the CExtComboBox class which is derived from the simple CComboBox. We spent a lot of time to create the Prof-UIS skinned extended combo box but failed. It simply ignores the WM_PAINT message and draws itself in some other way. If you find a way how to create a skinned version of CComboBoxEx then you will be able to use it in the File Dialog window.

If you are creating these dialogs from scratch and encounter this error, please send us the source code so we can test it on our side and find out what is wrong.