How to change the height of a ComboBox?

V

vbel

Can anyone tell me how can I resize the height of a
ComboBox without changing the font size?
 
1

100

Hi vbel,
The height of the combobox cannot be chaged unless if you make it
owner-draw.

B\rgds
100
 
V

vbel

By owner-draw you mean I have to paint the ComboBox myself?
Well, this won't help because I cannot change the height
anyways. I mean I can paint lets say a height of 50, but
the real height will stay the original...19 or so.
 
H

Herfried K. Wagner

Hello,

vbel said:
Can anyone tell me how can I resize the height of a
ComboBox without changing the font size?

\\\
Private Declare Auto Function SendMessage Lib "user32.dll" ( _
ByVal hwnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32 _
) As Int32

Private Const CB_SETITEMHEIGHT As Int32 = &H153

Private Sub Form1_Load( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs _
) Handles MyBase.Load
SetComboEditHeight(Me.ComboBox1, 50)
End Sub

Private Sub SetComboEditHeight( _
ByVal Control As ComboBox, _
ByVal NewHeight As Int32 _
)
SendMessage(Control.Handle, CB_SETITEMHEIGHT, -1, NewHeight)
Control.Refresh()
End Sub
///

Regards,
Herfried K. Wagner
 

aru

Joined
Feb 27, 2012
Messages
4
Reaction score
0
If you set your ComboBox.IntegralHeight Property to true it will automatically resize.
and change the ItemHeight and also set the DrawMode.OwnerDrawVariable.


Note : If the DrawMode property is set to DrawMode.OwnerDrawVariable, this property has no effect.


Aravinda
Bilingual IT Engineer.:fool:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top