Solved

How do I  set the height of a combobox?

Posted on 1998-03-06
4
404 Views
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
AndersWP
0
Comment
Question by:AndersWP
  • 2
4 Comments
 
LVL 3

Expert Comment

by:williams2
Comment Utility
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);
begin
  ComboBox1.Style:= csOwnerDrawFixed;
  // It's nessecary to set this property due to changes in size.
  ComboBox1.DropDownCount:= 12;
  ComboBox1.ItemHeight:= 15;
end;

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.
0
 
LVL 1

Author Comment

by:AndersWP
Comment Utility
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.
0
 
LVL 5

Accepted Solution

by:
inter earned 200 total points
Comment Utility
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);
begin
  Height := 70;
end;

Now the edit box has height 70

Sincerely,
Igor
0
 
LVL 1

Author Comment

by:AndersWP
Comment Utility
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.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now