Board index » Visual Studio » How to determine the number of visible items in the drop down of a CComboBox
|
uanto
|
|
uanto
|
How to determine the number of visible items in the drop down of a CComboBox
Visual Studio351
Hello, Is there an easy way to determine how many items are currently visible in the dropdown list of a CComboBox. (I dont need the total number from GetCount) Thanks - |
| Tom
Registered User |
Thu Sep 22 16:06:03 CDT 2005
Re:How to determine the number of visible items in the drop down of a CComboBox
Seems to me you could use GetDroppedControlRect() and GetItemHeight() to
figure it out. Tom "D Smith" <kingospam(no spam)@adelphia.net>wrote in message QuoteHello, - |
| Joseph
Registered User |
Fri Sep 23 00:21:53 CDT 2005
Re:How to determine the number of visible items in the drop down of a CComboBox
Take a look at my dynamically-resizing combo box on my MVP Tips site. I set the size to
make it as unlikely as possible that a scrollbar would be needed. \ joe On Thu, 22 Sep 2005 16:20:41 -0400, "D Smith" <kingospam(no spam)@adelphia.net>wrote: QuoteHello, Web: www.flounder.com">www.flounder.com MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm - |
| D
Registered User |
Fri Sep 23 12:51:39 CDT 2005
Re:How to determine the number of visible items in the drop down of a CComboBox
In case anyone is interested, I think this is another case of inaccurate
MicroSoft documentation. I had tried GetDroppedControlRect first and the numbers did not seem to work out. Of course I was assuming that the rectangle returned was the rectangle that gets dropped BELOW the edit box. I looked at it again and it seems like the rectangle returned contains both the dropped list and the editbox. I subtracted off the editbox item height [GetItemHeight(-1)]and 8 more (for spacing around the editbox) and arrived at a number that could be divided by GetItemHeight(0) to arrive at the correct number of visible items. - |
| Joseph
Registered User |
Sat Sep 24 11:29:53 CDT 2005
Re:How to determine the number of visible items in the drop down of a CComboBox
Instead of 8, you might want to look at this in terms of ::GetSystemMetrics for border
sizes. It could change depending on your display resolution. joe On Fri, 23 Sep 2005 13:51:26 -0400, "D Smith" <kingospam(no spam)@adelphia.net>wrote: QuoteIn case anyone is interested, I think this is another case of inaccurate Web: www.flounder.com">www.flounder.com MVP Tips: www.flounder.com/mvp_tips.htm">www.flounder.com/mvp_tips.htm - |
