Mar 11, 2004 #1 hstijnen Programmer Joined Nov 13, 2002 Messages 172 Location NL Hi, How can I find the height of a combobox when it is dropped down? (the property Height appears not to change)
Hi, How can I find the height of a combobox when it is dropped down? (the property Height appears not to change)
Mar 11, 2004 #2 itsgsd Programmer Joined Sep 4, 2002 Messages 163 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. Upvote 0 Downvote
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.