How do I  set the height of a combobox?

Posted on 1998-03-06
Medium Priority
Last Modified: 2010-04-06
How do I  set the height of an ownerdrawn combobox in Delphi? I have tried setting the Height property at design time and at various stages of initialization. I have also tried selecting a larger font for the combobox.
All without success.

Does anyone know how to get around this?

Thanks in Advance
Question by:AndersWP
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 1360198
This is not that easy to get around with. You cannot set the Height property on ComboBoxes, but you can do this:

procedure TForm1.FormCreate(Sender: TObject);
  ComboBox1.Style:= csOwnerDrawFixed;
  // It's nessecary to set this property due to changes in size.
  ComboBox1.DropDownCount:= 12;
  ComboBox1.ItemHeight:= 15;

To set specific height, you must individually change the properties untill they fit into your needs. Else you'll have to make up your own ComboBox component.

Author Comment

ID: 1360199
Thank you for your swift answer. Unfortunately is does not really cover my problem. Re-reading my question, I can see that I not been specific enough, so let me elaborate a bit:

What I have is a csOwnerDrawVariable combobox, and the height that troubles me is the height of the edit field part of the box, i.e. the height of the box when it is not dropped down.

Sorry about that.

Accepted Solution

inter earned 800 total points
ID: 1360200
Double Click in OnMeasureItem Property and write down the following:(The sytle must be ownerdrawn)

procedure TForm1.ComboBox1MeasureItem(Control: TWinControl; Index: Integer;
  var Height: Integer);
  Height := 70;

Now the edit box has height 70


Author Comment

ID: 1360201
Thank you - I somehow got the idea that what you propose would only affect the height of items in the dropped down list, but it works just fine.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question