- // don't make the drop down list too tall, arbitrarily limit it to 40
- // items max and also don't leave it empty
- size_t nItems = GetCount();
- if ( !nItems )
- nItems = 9;
- else if ( nItems > 24 )
- nItems = 24;
-
- // add space for the drop down list
- const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
- height += hItem*(nItems + 1);
+ int w, h;
+ DoGetSize(&w, &h);
+
+ // Don't change the height if it's already this size
+ if (h == height)
+ {
+ height = -1;
+ }
+ else
+ {
+ // don't make the drop down list too tall, arbitrarily limit it to 40
+ // items max and also don't leave it empty
+ size_t nItems = GetCount();
+ if ( !nItems )
+ nItems = 9;
+ else if ( nItems > 24 )
+ nItems = 24;
+
+ // add space for the drop down list
+ const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
+ height += hItem*(nItems + 1);
+ }