Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 337007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:17:44+00:00 2026-05-12T10:17:44+00:00

In Delphi, all the TEdit and TComboBox controls are 21 pixels high by default.

  • 0

In Delphi, all the TEdit and TComboBox controls are 21 pixels high by default. In the case of TComboBox, this size is absolute and trying to stretch it to something bigger doesn’t work. In the case of TComboBoxEx though, the default height is 22 pixels, which makes it stand out a little on any form where you use it. Now according to the Microsoft docs, ComboBoxEx is essentially a ComboBox with owner-drawn functionality being handled to allow images and indentation.

So is it possible to make my TComboBoxEx controls 21 pixels high? What does this depend on?

Update: I added a Quality Central report on the issue, as suggested by Roddy. Also, I found a fix. Apparently, the size depends on the size of item -1 in the combobox. So you set that size to 15 (or one pixel less than the default size) and the box shrinks to the more familiar 21 pixels.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:17:44+00:00Added an answer on May 12, 2026 at 10:17 am

    I found a fix. Delphi seems to have a couple of bugs relating to this:

    1. The value of the published ItemHeight property is forced to be 16, because the TComboBoxEx class overrides the GetItemHt function to be a hard-coded 16. No regard whatsoever for the actual size of the item – strange, as this works perfectly on TComboBox. I don’t know why they decided to go with this strategy. Probably to ensure the images will always fit.
    2. Delphi doesn’t actually call the CB_SETITEMHEIGHT message, so even if you override this function nothing changes.

    Update:

    As pointed out by mghie, my initial idea of using a hard-coded value of 15 in calling the message doesn’t work well at different DPI settings. So I am now using a calll to GetTextMetrics to determine the height. Added to the height of the font is the value of GetSystemMetrics(SM_CYBORDER).

    This is based on the way the VCL determines the size of a TEdit. I don’t think it is quite right, but since the goal is to have the ComboBoxEx the same size as TEdit it is probably as close as we’ll get. And it works at DPI settings of 96, 120, 144 and 192.

    The height of the ComboBoxEx is determined by the height of item -1. So items 0 to count-1 are the actual list items, but item -1 is the height used for the editor. If you set that height to 15, the height of the control is corrected to be 21 pixels (see update above for scaling issues). I think Mason may be right that the font size plays a part here (probably resizes the item), butyou can make it work just fine by adjusting the item size.

    It does seem to introduce a new (in my view, smaller) problem in that at 96 DPI 16-pixel high images loose the bottom-most line when shown in the editor portion, but that’s hardly noticeable.

    So the fix then, is to call this code:

    GetTextMetrics(Canvas.Handle, TM);
    SendMessage(Handle, CB_SETITEMHEIGHT, -1, 
      GetSystemMetrics(SM_CYBORDER) * 2 + TM.tmHeight);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does .net have the equivilent of Delphi's QuotedStr function. This replaces all quotes with
First of all: this is not a duplicate of Delphi and SAPI . I
I've created setups for all my Delphi tools with Inno Setup for years. Now
I have tested all my systems developed in Delphi (in Windows XP) on Wine
How to dim / fade all other windows of an application in Delphi 2009.
How can I detect all WiFi networks availables using Delphi? (source: filebuzz.com )
I need loging all HTTP request (from any application). I have Delphi 7.0. Anybody
I am working with delphi, I want a list of all files of a
I have a Client/Server application written Delphi. Essentially all the application is doing is
Almost all of the Delphi code I have read has all the class type

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.