Results 1 to 9 of 9

Thread: Change Comboxbox suggest font

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Change Comboxbox suggest font

    I sometimes concatenate things like Comany Name, Last Name, first Name, and then use them in my combobox list items. I can set the font to a fixed width font for the combobox list items but the "suggest" items font does not change. Which makes the list look very ragged. I could not find an solution to this problem, at least not one that I could understand.

    Any information on this subject would be appreciated.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Change Comboxbox suggest font

    When you say "suggest", are you talking about auto-complete? Can you provide a screenshot to illustrate the issue?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: Change Comboxbox suggest font

    jmc,

    thanks for the reply. It's not the autocomplete, it's the list that drops down when the "autoCompleteMode" is set to "suggest". The list that drops down when you click the combobox down arrow is formatted fine, it uses the combobox font property. but the "Suggest" drop down list doesn't.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Change Comboxbox suggest font

    For future reference, please don't upload a Word document that we have to download and open when you could just upload an image that will be displayed inline in your post, meaning that we don't have to do anything to see it.

    As for the issue, there's no public managed interface for that so, at the very least, you'd have to inherit ComboBox and do it from the inside. You might still have to use unmanaged code too and I'm afraid that I have no idea how it would be done and no time to investigate.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: Change Comboxbox suggest font

    jmc,

    Thanks anyway, I'll either live with it or turn suggest off. Maybe I'll let the client decide.

  6. #6
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Change Comboxbox suggest font

    The window that pops up for auto suggestion is not the same window that the ComboBox uses as it normal dropdown. Look at the lower right corner of the auto suggest window and you would see a difference. MS most likely overlooked setting the font on this other window. If you can get the window handle, you should be able to use the Win32 API to set the font yourself. I would look into it myself when I get some time.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: Change Comboxbox suggest font

    Niya,

    thanks for the reply. If you find anything useful please share. I've been searching but didn't find anything that made sense to me.

  8. #8
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Change Comboxbox suggest font

    This is one of MS's less bright moments. The Auto-Suggest Dropdown is not actually part of the combobox control at all but a completely separate API set. It therefore uses the system font and I'm far from sure that there is any way to change it. Even if it is possible you'd have to intercept WndProc and rewrite a whole bunch of 'behind-the-scenes' API to implement it. It says something that neither of the two alternative 3rd party combobox controls I happen to have available to me have attempted to change this lack of font synchronisation!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,509

    Re: Change Comboxbox suggest font

    dunfidlin,

    thanks for the information.

    For now I've given up on using the "Suggest" mode. I'm using this code a substitute,
    Code:
        Private Sub CompanyToolStripComboBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles CompanyToolStripComboBox.Enter
            Me.CompanyToolStripComboBox.DroppedDown = True
        End Sub
        Private Sub CompanyToolStripComboBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles CompanyToolStripComboBox.Leave
            Me.CompanyToolStripComboBox.DroppedDown = False
        End Sub
    
        Private Sub CompanyToolStripComboBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles CompanyToolStripComboBox.KeyPress
            Me.CompanyToolStripComboBox.DroppedDown = True
        End Sub
    The dropdown list uses the combobox font so if I set the font to a fixed width font, I can create nice columns.

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