-
I am placing the font list into the ImageCombo
Box control. I found that the standard ComboBox
did not have enough flexibility as the ImageCombo
Box control. Anyways, I want to know if there is a way
to sort the items alphabeticaly in the ImageCombo Box
control.
Code:
'Initialize variables
Dim strFont As String
Dim intFont As Integer
'Populates cboFont with the system fonts
For intFont = 1 To Screen.FontCount - 1
'Stores the font into a variable for faster retrieval instead of
'referencing Screen.Fonts several times.
strFont = Screen.Fonts(intFont)
imgcboFonts.ComboItems.Add , strFont, strFont
Next
Does anyone have any idea? There is no sorting property
for this control so there might be a way to do this from
the Windows API.
-
Why not just add it to a standard ComboBox, sort them, then add them to the ImageCombo?
-
I would add them to a Combo Box, but I need to access the
font by the font name. I am storing the font name into a
database. When I want to select the font in the Combo Box,
I can only access an item by its Index.
With an ImageCombo Box, I can use the Key property and
access the font name throught the Key.
I cant find out how to sort the ImageCombo though.
-
What I tend to do...
Insert into a ComboBox, the Name of the font, then concatenate it with some delimiter, then contcatenate the key tou want to put in there.Then another delimiter and the index of the image you want to use. Then, as the combobox is sorted, I break apart each item in the list and apply it to the ImageCombo.