We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing height of custom ListBox in ComboBoxBarItem

Thread ID:





5804 Jul 17,2003 10:13 PM UTC Aug 1,2003 12:54 AM UTC WinForms 6
Tags: Tools
Sue Harris
Asked On July 17, 2003 10:13 PM UTC

Hi, Could you please tell me how to change the initial height of a ComboBoxBarItem's custom ListBox? It always seems to create with the same height (of approximately 80 pixels). I would like to size my custom ListBox to fit the items. Thanks, Sue

Ramesh Praveen [Syncfusion]
Replied On July 18, 2003 02:51 PM UTC

The ComboBoxBarItem has a MaxDropDownItems property that will let you change the height. Regards, Praveen

Sue Harris
Replied On July 20, 2003 06:48 PM UTC

The MaxDropDownItems seems to have no effect when using a customer listbox, only when using the internal listbox. Do you have any other suggestions?

Ramesh Praveen [Syncfusion]
Replied On July 22, 2003 06:16 PM UTC

I tested this in our XPMenus sample and this does seem to work in the fontComboBoxBarItem (in the TextEditorForms.cs). Regards, Praveen

Sue Harris
Replied On July 27, 2003 09:49 PM UTC

It mostly works in the sample you suggested, but if the MaxDropDownItems is less than 4, it doesn't appear to work correctly. I have attached a sample which I'm experiencing the problem in. It has three combo box bar items, the first only has 3 items (and a MaxDropDownItems of 6), and I want to be able to set the height to only display the 3 items (exclude the white space below). Nothing I've tried will remove the white space. The second has several items, and the MaxDropDownItems of 3, and it is drawing 5.5 items. The last combo box bar item appears to work correctly. Regards, Sue

Ramesh Praveen [Syncfusion]
Replied On July 29, 2003 12:49 AM UTC

Hi, It seems that there is a 75 pixel minimum height requirement for the dropdown hard coded in source. I have discussed with our developers and we will remove this in our next release. I will notify you. Sorry for the inconvenience. Regards, Praveen

Sue Harris
Replied On August 1, 2003 12:54 AM UTC

Thanks, Although I'm still going to be waiting for that fix, I have found a workaround for anyone else experiencing the same problem. In the ListBox's OnVisibleChanged event: private void listBox1_VisibleChanged(object sender, EventArgs e) { if ( this.Visible ) { int newHeight = this.listBox1.ItemHeight * Math.Min(this.comboBoxBarItem1.MaxDropDownItems, this.listBox1.Items.Count); if ( ( this.listBox1.Parent != null ) && (this.listBox1.Parent.Parent != null) ) { this.listBox1.Parent.Parent.Height = newHeight; this.listBox1.Parent.Height = newHeight; this.listBox1.Height = newHeight; } } }


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon