Click here to Skip to main content
15,891,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
How to change ComboBox's ItemHeight in C# WinForm Application

Thanks
Posted
Updated 12-Aug-10 22:46pm
v2

1 solution

You can use the ItemHeight[^] property, but using this property is not trivial (your ComboBox must be owner-drawn). Read the remarks section from the MSDN link for ItemHeight property.

Also check out MeasureItem[^]. This page contains a very useful example for you. ;)

Oh, you CAN set it - and for ListBoxes, too.
VB
Public Const CB_SETITEMHEIGHT = &H153
   Public Const CB_GETITEMHEIGHT = &H154
   Public Const LB_SETITEMHEIGHT = &H1A0
   Public Const LB_GETITEMHEIGHT = &H1A1



Use: SendMessage(handleOfContro, CBxx/LBxx, 0, PixelHeightInBytes);

http://msdn.microsoft.com/en-us/library/windows/desktop/bb775911(v=vs.85).aspx[^]
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900