Solved

How do I  set the height of a combobox?

Posted on 1998-03-06
4
407 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
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);
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
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.
0
 
LVL 5

Accepted Solution

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

Now the edit box has height 70

Sincerely,
Igor
0
 
LVL 1

Author Comment

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

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

11 Experts available now in Live!

Get 1:1 Help Now