Owner drawn combo question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve Marshall

    #1

    Owner drawn combo question

    Hi All,

    I'm working on an owner-drawn combo box which will display multiple
    columns in the list, either from a table in an associated DataSourse or
    from delimited strings in the Items collection. It's all going quite
    well, and was actually easier to achieve than I had expected.

    But I am seeing one peculiar anomaly when I make a selection from the
    list. Eveything works perfectly if the list is populated from a
    DataSource. But if the list is populated from the typed-in Items
    collection, AND the DropDownStyle is set to Simple or DropDown, the
    edit field appears to get re-drawn WITHOUT the DrawItem method being
    called! Or if it IS called, the DrawItemState does NOT have the flag
    set indicating this is the edit field being drawn. The only pattern I
    can see here is that the 2 DropDownStyles that do this are the ones
    where the edit field is editable by the user. But I can't see why that
    should matter.

    The above is what I THINK is happening - it's actually quite difficult
    to debug this, because the switching of focus between the test form and
    the code window generates all sorts of events which confuse the issue
    greatly. In my DrawItem code I test for the flag telling me the edit
    field is being drawn, and if I put a breakpoint in the code, it is
    never hit in the conditions described.

    Anyone know what is going on here? Is there some other event I need to
    override? Another flag in the DrawItemState? Is this a bug in .NET?

    Thanks and regards

Working...