|
-
May 9th, 2013, 08:21 PM
#1
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.
-
May 9th, 2013, 08:23 PM
#2
Re: Change Comboxbox suggest font
When you say "suggest", are you talking about auto-complete? Can you provide a screenshot to illustrate the issue?
-
May 9th, 2013, 09:17 PM
#3
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.
-
May 9th, 2013, 10:05 PM
#4
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.
-
May 9th, 2013, 11:19 PM
#5
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.
-
May 10th, 2013, 04:16 AM
#6
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.
-
May 10th, 2013, 11:13 AM
#7
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.
-
May 10th, 2013, 12:08 PM
#8
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!
-
May 10th, 2013, 12:32 PM
#9
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|