msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Increase height of items in a combo drop down

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI
Author Message
Articulate



Joined: 04 Oct 2007
Posts: 7

PostPosted: Tue Feb 05, 2008 10:55 am    Post subject: Increase height of items in a combo drop down Reply with quote

Is there a way using API that I can increase the height of each item in a
combo drop down. I wish to space out the individual items more than the
default. I've found samples to incread the height of the drop box itself but
not the items. Any ideas?

Thank you.

Archived from group: microsoft>public>vb>winapi
Back to top
View user's profile Send private message
Karl E. Peterson



Joined: 04 Oct 2007
Posts: 4836

PostPosted: Tue Feb 05, 2008 4:37 pm    Post subject: Re: Increase height of items in a combo drop down Reply with quote

Articulate wrote:
> Is there a way using API that I can increase the height of each item in a
> combo drop down. I wish to space out the individual items more than the
> default. I've found samples to incread the height of the drop box itself but
> not the items. Any ideas?

You're going to want to search on "owner drawn"...

http://www.google.com/search?q=owner+drawn+combo

--
..NET: It's About Trust!
http://vfred.mvps.org
Back to top
View user's profile Send private message
MikeD



Joined: 04 Oct 2007
Posts: 3348

PostPosted: Tue Feb 05, 2008 9:17 pm    Post subject: Re: Increase height of items in a combo drop down Reply with quote

"Karl E. Peterson" wrote in message
news:%23HGod6CaIHA.4332@TK2MSFTNGP04.phx.gbl...
> Articulate wrote:
>> Is there a way using API that I can increase the height of each item in a
>> combo drop down. I wish to space out the individual items more than the
>> default. I've found samples to incread the height of the drop box itself
>> but
>> not the items. Any ideas?
>
> You're going to want to search on "owner drawn"...
>
> http://www.google.com/search?q=owner+drawn+combo
>


Doesn't need to be owner-drawn.

Option Explicit

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
Private Const CB_SETITEMHEIGHT = &H153

Private Sub Form_Load()

With Combo1
Call SendMessage(.hwnd, CB_SETITEMHEIGHT, 0&, ByVal 20&)
.AddItem "Apples"
.AddItem "Oranges"
.AddItem "Pears"
.AddItem "Pineapples"
End With

End Sub


lParam of the SendMessage functions specifies the height in pixels. For more
information on this message, see the following:

http://msdn2.microsoft.com/en-us/library/bb775911(VS.85).aspx


--
Mike
Microsoft MVP Visual Basic
Back to top
View user's profile Send private message
Karl E. Peterson



Joined: 04 Oct 2007
Posts: 4836

PostPosted: Tue Feb 05, 2008 8:40 pm    Post subject: Re: Increase height of items in a combo drop down Reply with quote

MikeD wrote:
> Private Const CB_SETITEMHEIGHT = &H153

Not sure how I managed to never notice that before! Perfect.
--
..NET: It's About Trust!
http://vfred.mvps.org
Back to top
View user's profile Send private message
Articulate



Joined: 04 Oct 2007
Posts: 7

PostPosted: Tue Feb 05, 2008 10:52 pm    Post subject: Re: Increase height of items in a combo drop down Reply with quote

Thanks to both of you. That works perfectly.

"MikeD" wrote:

>
> "Karl E. Peterson" wrote in message
> news:%23HGod6CaIHA.4332@TK2MSFTNGP04.phx.gbl...
> > Articulate wrote:
> >> Is there a way using API that I can increase the height of each item in a
> >> combo drop down. I wish to space out the individual items more than the
> >> default. I've found samples to incread the height of the drop box itself
> >> but
> >> not the items. Any ideas?
> >
> > You're going to want to search on "owner drawn"...
> >
> > http://www.google.com/search?q=owner+drawn+combo
> >
>
>
> Doesn't need to be owner-drawn.
>
> Option Explicit
>
> 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
> Private Const CB_SETITEMHEIGHT = &H153
>
> Private Sub Form_Load()
>
> With Combo1
> Call SendMessage(.hwnd, CB_SETITEMHEIGHT, 0&, ByVal 20&)
> .AddItem "Apples"
> .AddItem "Oranges"
> .AddItem "Pears"
> .AddItem "Pineapples"
> End With
>
> End Sub
>
>
> lParam of the SendMessage functions specifies the height in pixels. For more
> information on this message, see the following:
>
> http://msdn2.microsoft.com/en-us/library/bb775911(VS.85).aspx
>
>
> --
> Mike
> Microsoft MVP Visual Basic
>
>
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
Tooltip for combo box items Hi All, Does anybody have an idea as how to display tooltip in the combo box for an highlighted item in the drop down list? Regards, Madhu

Drag & Drop Shell items / stream format with VB's DataObject Problem: Setting up an stream format with VB's DataObject. Scenario: Drag & Drop of shell items in SysTree32, wrapped in an usercontrol, using COM interfaces. Operation (acting as drop target): In the ev

Height of Taskbar Hallo NG! I try to center a Child - from within a MDIForm, using the following code: GetWorkArea nLeft, nTop, nWidth, nHeight pLeft = (nWidth - 9450) \ 2 pTop = (nHeight - 7005) \ 2 However, this fails in Windows XP if the Taskbar is visible. So I should

Listview row height Hi all Is it possible to change the row height in a listview (report mode). I want to put a combobox in the listview but the row should be more or less the same height of the combobox. TIA Guy

Height of a font? I need to find the vertical size of a particular (changeable) font so I will know if it will fit into a fixed-size label, and can choose a smaller point size if it's too tall. I suspect the solution might be an API call to or maybe GetText
Post new topic   Reply to topic    msvisual.com Forum Index -> VB WinAPI All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group