?
Solved

How do I  set the height of a combobox?

Posted on 1998-03-06
4
Medium Priority
?
414 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
[X]
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
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 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);
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

649 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