Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to change drop down list Height of a ComboBox

How to change drop down list Height of a ComboBox

Scheduled Pinned Locked Moved C / C++ / MFC
jsonhelptutorial
6 Posts 4 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    poda
    wrote on last edited by
    #1

    Hai Friends, I am in need to change the height of the drop down list of a combo box. When a combo box is clicked, it shows only the first 8 items and remaining items can be scrolled to view. How to increase the height of this drop down list to view the desired number of combo items. I tried using MoveWindow API int ListHeight; ListHeight=SendMessage(Combo.hWnd,CB_GETITEMHEIGHT,0, 0); ListHeight=ListHeight*(Combo.GetCount()); MoveWindow(Combo.hWnd,Combo.Left,Combo.Top,Combo.Width,ListHeight,1); But does not work as we wish. Thanks for your help.

    R I D P 4 Replies Last reply
    0
    • P poda

      Hai Friends, I am in need to change the height of the drop down list of a combo box. When a combo box is clicked, it shows only the first 8 items and remaining items can be scrolled to view. How to increase the height of this drop down list to view the desired number of combo items. I tried using MoveWindow API int ListHeight; ListHeight=SendMessage(Combo.hWnd,CB_GETITEMHEIGHT,0, 0); ListHeight=ListHeight*(Combo.GetCount()); MoveWindow(Combo.hWnd,Combo.Left,Combo.Top,Combo.Width,ListHeight,1); But does not work as we wish. Thanks for your help.

      R Offline
      R Offline
      Rajkumar R
      wrote on last edited by
      #2

      combo box contains 3 windows, combo, edit, list. u have to change the height of list, in ur code u r trying to change the height of combo box. u can change the height in resource editor, if u want to change the height programmatically, try setting the size to list window, the handle to list box can be obtained from, CB_GETCOMBOBOXINFO message.

      1 Reply Last reply
      0
      • P poda

        Hai Friends, I am in need to change the height of the drop down list of a combo box. When a combo box is clicked, it shows only the first 8 items and remaining items can be scrolled to view. How to increase the height of this drop down list to view the desired number of combo items. I tried using MoveWindow API int ListHeight; ListHeight=SendMessage(Combo.hWnd,CB_GETITEMHEIGHT,0, 0); ListHeight=ListHeight*(Combo.GetCount()); MoveWindow(Combo.hWnd,Combo.Left,Combo.Top,Combo.Width,ListHeight,1); But does not work as we wish. Thanks for your help.

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        1/ In the resource editor, click on the drop down arrow for the combo box - this will give an outline of the drop down box, and you can change that 2/ Try using CM_SETMINVISIBLE - I've not used this, but it looks useful. 3/ Alternatively, use CB_GETCOMBOBOXINFO to fill in a COMBOBOXINFO structure (don;t forget to fill in it's cbSize first). This will give you the window handle to the List control it uses for the drop down part. You can then use SetWindowPos (NULL, 0,0, cx,cy, SWP_NOMOVE | SWP_NOZORDER); to change the size. I hope that's given you enough ammunition! Iain.

        Iain Clarke appearing in spite of being begged not to by CPallini.

        1 Reply Last reply
        0
        • P poda

          Hai Friends, I am in need to change the height of the drop down list of a combo box. When a combo box is clicked, it shows only the first 8 items and remaining items can be scrolled to view. How to increase the height of this drop down list to view the desired number of combo items. I tried using MoveWindow API int ListHeight; ListHeight=SendMessage(Combo.hWnd,CB_GETITEMHEIGHT,0, 0); ListHeight=ListHeight*(Combo.GetCount()); MoveWindow(Combo.hWnd,Combo.Left,Combo.Top,Combo.Width,ListHeight,1); But does not work as we wish. Thanks for your help.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          poda wrote:

          How to increase the height of this drop down list to view the desired number of combo items.

          Employ a smarter combobox.

          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          1 Reply Last reply
          0
          • P poda

            Hai Friends, I am in need to change the height of the drop down list of a combo box. When a combo box is clicked, it shows only the first 8 items and remaining items can be scrolled to view. How to increase the height of this drop down list to view the desired number of combo items. I tried using MoveWindow API int ListHeight; ListHeight=SendMessage(Combo.hWnd,CB_GETITEMHEIGHT,0, 0); ListHeight=ListHeight*(Combo.GetCount()); MoveWindow(Combo.hWnd,Combo.Left,Combo.Top,Combo.Width,ListHeight,1); But does not work as we wish. Thanks for your help.

            P Offline
            P Offline
            poda
            wrote on last edited by
            #5

            Thanks for you replys friends. But CB_GETCOMBOBOXINFO is undefined in my system. What SDK should I install to get it work. Please give me the link to update my SDK. The winuser.h header does not have such #define. My system is WinXP with SP2 and SDK is March 2006 Release.

            R 1 Reply Last reply
            0
            • P poda

              Thanks for you replys friends. But CB_GETCOMBOBOXINFO is undefined in my system. What SDK should I install to get it work. Please give me the link to update my SDK. The winuser.h header does not have such #define. My system is WinXP with SP2 and SDK is March 2006 Release.

              R Offline
              R Offline
              Rajkumar R
              wrote on last edited by
              #6

              #if(_WIN32_WINNT >= 0x0501) #define CB_GETCOMBOBOXINFO 0x0164 #endif /* _WIN32_WINNT >= 0x0501 */ is defined like above in winuer.h. define _WIN32_WINNT >= 0x0501. if not found install the latest SDK.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups