Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Height of dropped-down ComboBox?

Status
Not open for further replies.

hstijnen

Programmer
Nov 13, 2002
172
NL
Hi,

How can I find the height of a combobox when it is dropped down? (the property Height appears not to change)
 
You need to determine the height of the dropdown as well as the height of the ComboBox, something like this:

Code:
  int NumItems;

  if (ComboBox1->DropDownCount > ComboBox1->Items->Count)
    NumItems = ComboBox1->Items->Count;
  else NumItems = ComboBox1->DropDownCount;

  if (!NumItems) NumItems = 1;

  int Height = ComboBox1->Height + (NumItems * ComboBox1->ItemHeight);

Of course you could use a min function instead of the if/else statement.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top