How do I set the Mh3dCombo Textcolor property and keep the individual color of the text on each line?

Posted on 2004-11-16
Last Modified: 2013-12-25
I have a problem with the Mh3dCombo box. I set the Textcolor property and then add the item, for each one
cboTemp.TextColor = QBColor(9)
cboTemp.AddItem "Blue"
cboTemp.TextColor = QBColor(4)
cboTemp.AddItem "Red"
cboTemp.TextColor = QBColor(0)
cboTemp.AddItem "Black"

It all looks well when I drop down the combo box, but when i hover the mouse up or down, all items get re-painted to the last colour i used when adding the items, in this case Black.

Any ideas how to keep the colour as was at add time? maybe an API?
Question by:tiseffies
    LVL 76

    Expert Comment


    Use the ListTextColor property. This applies to individual entries. The TextColor propert applies to the whole control. These are extracts from the Help File

    The TextColor property sets or returns the color used to draw all text displayed in the control. Three colors are used when creating the 3-D effect for the control border and text: LightColor, ShadowColor, and TextColor.

    [form!]Mh3dCombo.TextColor[ = colorref& ]

    Data Type

    Default Value


    The ListTextColor property sets or returns the color used for the text in the specified line.

    [form!]Mh3dCombo.ListTextColor(index As Integer)[ = colorref& ]

    The parameters for the ListTextColor property are described below:


    Data Type

    Author Comment

    This property behaves the same way for me as textcolor, except that when i hover up/down with the mouse on the combo it changes the colour to black! Here is  a snippet. Am I missing something?

    Dim i%

    do until rs001.eof
      cboTemp.AddItem rs001!field
      Select case rs001!field
           cboTemp.ListTextColor(i) = QBColor(9)
           cboTemp.ListTextColor(i) = QBColor(4)
           cboTemp.ListTextColor(i) = QBColor(0)
      End Select

    I also tried setting the listtextcolor after the loop one at a time, after been added, same problem!

    Author Comment

    Here is an interesting observation I made whilst testing this out. The style of my mh3dcombo is 2 - mhDropDownListCombo. When I change the style to 1 - MhDropDownCombo it works! But that is not a suitable style for me.
    Any ideas?
    LVL 76

    Expert Comment

    I don't think it's a colour thing.
    This works OK for me.

    Mh3dCombo1.AddItem "abc"
    Mh3dCombo1.AddItem "def"
    Mh3dCombo1.AddItem "ghi"
    Mh3dCombo1.ListTextColor(0) = vbBlue
    Mh3dCombo1.ListTextColor(1) = QBColor(4)
    Mh3dCombo1.ListTextColor(2) = vbBlack
    LVL 76

    Expert Comment

    Sorry, didn't refresh.
    I'm using style 2. Can't use 1 anyway, probably because I don't have a license. I only downloaded it to see what the problem was.

    Author Comment

    I tried your simple example in a new project. I still have the problem. Maybe I'm not explaining myself properly.
    Click the arrow to drop down the combo, then move the mouse pretending you'll select something, so move the mouse over the drop down list, the color changes.
    Also my version of the control is. MHCMBO32.OCX
    I can't think of anything else to try.

    Author Comment

    I found a workaround. I noticed that once I picked an item from the combo the problem goes away. That is if i drop the combo box down again, the colours are in place on the items.
    So, If I add a blank item at the start of the combo and set the index to it, it won't change the colour of the items in the list, and the user still has to select an item like before. Not much of a change. I think i will go with that unless someone has a better idea (and can get my problem on his/her machine!)

    LVL 76

    Accepted Solution

    On my system, when the mouse cursor is over an item, the background color is black and the text changes to white, but the original colours are restored after the mouse pointer has moved away.

    The good news is that my version is, so it's probably a fixed problem and you could update. Hopefully your license will still work, otherwise it's 149 dollars.

    Home page:

    Product page:

    Author Comment

    i only had ole 7 sp10 to test with and that still gave me the problem, so i downloaded ole7 sp18 and that fixes the bug.
    obviously there is not other workaround as it is a control bug/limitation so i will consider upgrading the control in my app.
    thanks for your help

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Suggested Solutions

    If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now