12 Replies - 7684 Views - Last Post: 10 April 2012 - 07:30 PM Rate Topic: -----

#1 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 11-March 11

Increase height of combobox drop down list?

Posted 03 April 2012 - 02:56 PM

Is this possible? The issue I'm having is I have 3 items in my combobox however when I maximize my window the items do not enlarge and are the same size(or relative) to what they were prior to maximizing, hence overlapping. Is there a way? I've ony known how to increase width.
Is This A Good Question/Topic? 0
  • +

Replies To: Increase height of combobox drop down list?

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: Increase height of combobox drop down list?

Posted 04 April 2012 - 08:46 AM

None of your other controls resize relatively automatically either - unless you have written code to do that or used the Anchor property on everything to make them resize.

I can't visualize what you are describing as the problem. The items in the combo box aren't resizing. So. That's pretty normal. How is it a problem? Can you show us screenshots? In this case a picture really is worth a thousand words.
Was This Post Helpful? 0
  • +
  • -

#3 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1623
  • View blog
  • Posts: 5,199
  • Joined: 25-September 09

Re: Increase height of combobox drop down list?

Posted 04 April 2012 - 09:28 AM

Also, a combobox, much like a single line textbox has no changable height. In order to scale the height of a combobox you have to increase the size of the font it contains.

So if you were to try
Combobox1.Height = 150
msgbox(Combobox1.Height)

Would result in 21 as that is the default height for the default VS font used.

But if you were to try
Combobox1.Font = New Font(Combobox1.Font.Name, 30)
msgbox(Combobox1.Height

The combobox would grow to fit the new font in height.
And you would receive a message box showing 54 as that is the height it grew to from setting the default fontsize to 30.

You might look at this link on resizing controls with forms

This post has been edited by CharlieMay: 04 April 2012 - 09:33 AM

Was This Post Helpful? 0
  • +
  • -

#4 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 11-March 11

Re: Increase height of combobox drop down list?

Posted 04 April 2012 - 11:35 AM

Thanks for the replies, I have attached a pic of what is currently happening. The modifying the text solution could work as a temporary solution however in order for it to not overlap I have to drastically reduce the text size(13) which makes it stand out(in a bad way :) ) compared to the rest of the enlarged form.

Attached File(s)

  • Attached File  cbo.bmp (164.55K)
    Number of downloads: 273

Was This Post Helpful? 0
  • +
  • -

#5 torind_2000  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 57
  • View blog
  • Posts: 292
  • Joined: 22-August 11

Re: Increase height of combobox drop down list?

Posted 04 April 2012 - 11:53 AM

i believe you need to set the integral height property of the combo boxes to true. that should fix the boxes so they dont show partial items.
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: Increase height of combobox drop down list?

Posted 04 April 2012 - 11:55 AM

To make life easier on everyone else, here is the image included in a post so you don't have to download it.

Attached Image
Was This Post Helpful? 1
  • +
  • -

#7 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1623
  • View blog
  • Posts: 5,199
  • Joined: 25-September 09

Re: Increase height of combobox drop down list?

Posted 04 April 2012 - 12:00 PM

It would appear that you have either set your Combobox DropDownHeight too low or you need to adjust it by setting to something that will show the dropdown text properly.

In my example above where I changed the font, If I were to populate that combobox and set the dropdownheight to something like 30 I would see the same results. Play around with that and see what you come up with.
Was This Post Helpful? 1
  • +
  • -

#8 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 11-March 11

Re: Increase height of combobox drop down list?

Posted 04 April 2012 - 12:08 PM

Thanks for uploading the image, I don't have access to any hosting sites at work, I appreciate it :)

Charlie, I will check those settings and mess around with it. With your example, I put in 30, the text was enlarged but it was even more overlapped than the pic, I will see if there is a dropdown height property to set, I appreciate all the help. :)
Was This Post Helpful? 0
  • +
  • -

#9 Criel  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 11-March 11

Re: Increase height of combobox drop down list?

Posted 10 April 2012 - 02:42 PM

Issue is still persisting, sadly.

I did find out that it's a custom drawn combobox, if that helps.

e.Graphics.FillRectangle(bgbrush, e.Bounds)

        Dim r As New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
        If e.Index >= 0 Then
            e.Graphics.DrawString(comboObj.Items(e.Index).ToString, txtfnt, bgbrush, x, y)
        End If

        e.DrawFocusRectangle()



The color and brush are delcared earlier, is there something i'm missing here that is causing the dropdownlist height to not resize upon maximizing? It's required that I have a custom drawn combobox in case some items in the combobox are ever longer than the combobox length.
Was This Post Helpful? 0
  • +
  • -

#10 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Increase height of combobox drop down list?

Posted 10 April 2012 - 03:04 PM

I don't know, perhaps try the SizeChanged event of the form.
Was This Post Helpful? 0
  • +
  • -

#11 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1623
  • View blog
  • Posts: 5,199
  • Joined: 25-September 09

Re: Increase height of combobox drop down list?

Posted 10 April 2012 - 04:33 PM

Why not just use the .DropdownWidth property of the standard combobox?

You could probably even write a routine to get the width of the longest text in the collection and size the dropdownwidth accordingly.

Of course you would have to use Net Framework 4 for this feature.
Was This Post Helpful? 0
  • +
  • -

#12 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5675
  • View blog
  • Posts: 12,192
  • Joined: 02-June 10

Re: Increase height of combobox drop down list?

Posted 10 April 2012 - 05:09 PM

Charlie: You're talking width while the OP is talking about a problem with HEIGHT of each item.
Was This Post Helpful? 0
  • +
  • -

#13 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1623
  • View blog
  • Posts: 5,199
  • Joined: 25-September 09

Re: Increase height of combobox drop down list?

Posted 10 April 2012 - 07:30 PM

Quote

It's required that I have a custom drawn combobox in case some items in the combobox are ever longer than the combobox length.

tlhIn`toqYea, you're probably right, I guess I read length as the length of the text in the combobox. Not the amount of items in the dropdown.

But then that leaves me with why does it have to be owner-drawn to handle this? The font size will determine the height of the combobox. The DropDownHeight can handle the height and the dropdownwidth can handle the width. There's even a .MaxDropDownItem.

And even with owner-drawn, there is the ItemHeight property. The only issue is, I think all of these only fall under version 4 of the framework.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1