CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2002
    Posts
    20

    problem from owner draw CComboBox with different list items' height.

    Hello gurus,

    I have an owner draw CComboBox with different list items' height. On some cases, the list box of combo box will hold some empty place at the bottom if you drop down the combo box.

    For example, In MeasureItem(), if you set item1's height to 20, item2's height to 10, then some empty place will be at the bottom of the dropeed list box, though for some items height pairs, there will be no empty place.

    My question is: is there any way to set the height of the list box of the combo box? so that I can remove the empty place at the bottom.

    Attach file is the simple test project.
    Any idea is welcome.

    Regards
    Yao Liwei
    Last edited by yaoliwei2000; May 30th, 2004 at 04:56 AM.

  2. #2
    Join Date
    Jan 2004
    Location
    Earth
    Posts
    567
    Since you specified different item's height ,I am guessing you used ownerdraw variable and not owner draw fixed? In the DrawItem function (or other places) you can use SetItemHeight to set the height of an item in pixels.

    TDM

  3. #3
    Join Date
    Jul 2002
    Posts
    20

    not item height, but the list box's height which contains the list items.

    Hi TDM,

    thanks for your idea.
    yes, it's a OWNERDRAWVARIABLE style combo box.
    Nevertheless I don't mean the height of the single item, but the scroll heigh of the list box of the combo box when the combo box is dropped down.

    The item height is set properly in OnMeasureItem() and works, the problems is there is some empty place below the last item in the dropped down list box.

    I know there is one function called SetHorizontalExtent() of CComboBox to set the horizontal scroll width of the list box. So my question is: is there any kind of function to set the vertical scroll height of the list box, not the height of the list box control itself, like SetVerticalExtent().

  4. #4
    Join Date
    Jul 2002
    Posts
    20

    screen shot of the problem.

    screen shot of the problem.
    Attached Images Attached Images

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured