How do i sort fonts in combobox?
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=819
Printed Date: 11 December 2024 at 11:41pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: How do i sort fonts in combobox?
Posted By: Nung_Gum
Subject: How do i sort fonts in combobox?
Date Posted: 09 June 2004 at 7:43pm
Dim FormatBar As CommandBar
Dim intLoopCount As Integer
Set FormatBar = CommandBars.Add("Format", xtpBarTop)
With FormatBar.Controls
Set Control = .Add(xtpControlComboBox, ID_COMBO_FONT, "Font")
Control.Width = 140
Control.DropDownListStyle = True
For intLoopCount = 1 To Screen.FontCount
Control.AddItem Screen.Fonts(intLoopCount)
Next intLoopCount
End with
'not sort combobox
'How do I ?
|
Replies:
Posted By: Nung_Gum
Date Posted: 11 June 2004 at 3:37am
'module bas
Public Sub QSStrings(sArray() As String, l As Integer, r As Integer)
Dim i As Integer
Dim j As Integer
Dim x As String
Dim y As String
i = l
j = r
x = sArray((l + r) / 2)
While (i <= j)
While (sArray(i) < x And i < r)
i = i + 1
Wend
While (x < sArray(j) And j > l)
j = j - 1
Wend
If (i <= j) Then
y = sArray(i)
sArray(i) = sArray(j)
sArray(j) = y
i = i + 1
j = j - 1
End If
Wend
If (l < j) Then QSStrings sArray(), l, j
If (i < r) Then QSStrings sArray(), i, r
End Sub
'form load()
Dim FormatBar As CommandBar
Dim ControlColorPopup As CommandBarPopup
Dim intLoopCount As Integer
ReDim fontArray(1 To Screen.FontCount) As String
Set FormatBar = CommandBars.Add("Format", xtpBarTop)
With FormatBar.Controls
Set Control = .Add(xtpControlComboBox, ID_COMBO_FONT, "Font")
Control.Width = 140
Control.DropDownListStyle = True
For intLoopCount = 1 To Screen.FontCount
fontArray(intLoopCount) = Screen.Fonts(intLoopCount)
Next intLoopCount
QSStrings fontArray(), LBound(fontArray), UBound(fontArray)
For i = LBound(fontArray) To UBound(fontArray)
Control.AddItem fontArray(i), i - 1
Next
|
|