Owner-Draw Combo + CBitmapButton on the same dialog
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Owner-Draw Combo + CBitmapButton on the same dialog

  1. #1
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230

    Unhappy Owner-Draw Combo + CBitmapButton on the same dialog

    Hello!
    I have an owner drawn combobox on a dialog managed via the function "void CMyDialogDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)" and everything works fine.

    But when on the same dialog I place CBitmapButton, the button doesn't get drawn!

    I think the subclassing of the bitmapbutton generates a conflict with the OnDrawItem, but I don't know how to workaround this problem!

    Is someone enogh brave to help me?
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

  2. #2
    Join Date
    Sep 2002
    Location
    14 39'19.65"N / 121 1'44.34"E
    Posts
    9,815

    Re: Owner-Draw Combo + CBitmapButton on the same dialog

    Originally posted by Andrea_Rossini
    I think the subclassing of the bitmapbutton generates a conflict with the OnDrawItem, but I don't know how to workaround this problem!
    Difficult to say without seeing any code... Are you calling the base class implementation of OnDrawItem()? What are you doing if the the value of the nIDCtl parameter is not that of your combobox?

  3. #3
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230
    I check the id of the combo on the standard overridden OnDrawItem and I call CDialog::OnDrawItem by default. (removed because of an assertion).

    Anyway the CBitmapButton is used like always (loadbitmaps at startup and nothing else).

    The problem is I don't have the code now. I'll be in office next week, and I'll send you my code... (if i don't solve everything by myself)

    thanks for the interest.
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

  4. #4
    Join Date
    Oct 2003
    Location
    Merate-North Italy
    Posts
    230
    Done !

    I Subclassed the combo this way:

    class CMyCombo : public CComboBox

    overriding the DrawItem member, then I associated an object of this custom class to the control in the dialog.



    Another question:
    how do I MeasureItem depending on the font of the Combo????
    ++++++++[>++++++++<-]>+.<+++[>++++<-]>+.<++[>-----<-]>.<+++[>++++<-]>++.<+++[>----<-]>-.----.
    God does not play dice with the universe.(A.Einstein)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center