Click to See Complete Forum and Search --> : Combo box problems
Ying8292
August 29th, 2001, 05:56 PM
Question 1: I have a drop-down combo box which can only diplay partial items in the list, because a scroll bar is added automatically when you have more than 5 items in the list. Is there a way to make the list longer, so it can display complete item list?
Question 2: Is there a way to let items in combo box list align from right to left?
Thanks for help.
berta
August 29th, 2001, 06:17 PM
q1: sorry no
q2: sorry no
hi,brt
ps U can try to find for some API... but I have some dubt for your requests... :o
<center>
<HR width=80%>
<img src='http://web.tiscali.it/bertaplanet/images/bertaplanet.gif'>
</center>
bhanuprakash
August 29th, 2001, 11:35 PM
CANNOT CHANGE THE HEIGHT OF LIST FOR A COMBO BOX.
CANNOT ALLIGN THE TEXT IN LIST FROM RIGHT TO LEFT.
FOR UR REQUIREMENT I THINK YOU USE THE LIST BOX
Iouri
August 30th, 2001, 07:06 AM
Here the code how to change the combo width
Private Declare Function MoveWindow Lib "user32" _
(ByVal hwnd As Long, ByVal x As Long, ByVal y As _
Long, ByVal nWidth As Long, ByVal nHeight As Long, _
ByVal bRepaint As Long) As Long
Private Sub Command1_Click()
Dim ret
Dim iScaleMode
iScaleMode = Combo1.Parent.ScaleMode
Combo1.Parent.ScaleMode = vbPixels
ret = MoveWindow(Combo1.hwnd, Combo1.Left, Combo1.Top, Combo1.Width, 1450, 1)
Combo1.Parent.ScaleMode = iScaleMode
End Sub
Iouri Boutchkine
iouri@hotsheet.com
Iouri
August 30th, 2001, 07:09 AM
Sorry that was height not width
For width use the following codr
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal _
hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Const CB_SETDROPPEDWIDTH = &H160
' Set the width of the list area of a ComboBox (in pixels)
Sub SetComboDropDownWidth(ComboBox As ComboBox, ByVal lWidth As Long)
Call SendMessageLong(ComboBox.hWnd, CB_SETDROPPEDWIDTH, lWidth, ByVal 0&)
End Sub
For example, you can use the above reusable routine to set a ComboBox's drop down list width to 200 pixels
using the following line of code:
SetComboDropDownWidth Combo1, 200
Iouri Boutchkine
iouri@hotsheet.com
Ying8292
August 30th, 2001, 05:30 PM
It works. Thanks.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.