Thread: ComboBox Height

  1. #1
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47

    ComboBox Height

    Hello...

    I observed that the height of the ComboBox is always the same one (21 pixels), and do not obtain to modify using MoveWindow(), SetWindowPos() or WM_GETMINMAXINFO...

    How to make the ComboBox only with 17 pixels of height, and to remove the edge?

    I use Win32 API...

    bye

  2. #2
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183
    One, if you're using a resource editor, you can just make it the correct height in there.
    Two, if you're using CreateWindow() (or CreateWindowEx), you specify the size when you call it. Look here.

    Again, for the style, do it in the resource editor or use CreateWindowEx and specify the style.

  3. #3
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    Code:
    case WM_CREATE:
    {
        HWND ComboBox;
    
        ComboBox = CreateWindow("COMBOBOX","",WS_CHILD|WS_VISIBLE|CBS_DROPDOWN,10,10,160,17,hwnd,(HMENU)ID_COMBOBOX,GetModuleHandle(NULL),NULL);
             
         SendMessage(ComboBox,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)"Teste1");
         SendMessage(ComboBox,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)"Teste2");
         SendMessage(ComboBox,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)"Teste3");
         SendMessage(ComboBox,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)"Teste4");
             
         WPARAM Font = (WPARAM)GetStockObject(DEFAULT_GUI_FONT);
             
         SendMessage(ComboBox,WM_SETFONT,Font,MAKELPARAM(FALSE,0));
    }break;
    The height is fixed, always...

  4. #4
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183
    Maybe somewhere later in the code you send a message to resize it? How do you know it's ten pixels? (or is it just not very big?)

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    A combobox won't dynamically resize AFAIK. You need to specify its height when creating it or it won't work.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    WM_SETFONT is probably adjusting the size based on the font.

    >> ...and to remove the edge?

    You'll have to do the drawing yourself if you don't like the default implementation.

    gg

  7. #7
    Registered User
    Join Date
    Mar 2007
    Posts
    142
    Quote Originally Posted by Codeplug View Post
    WM_SETFONT is probably adjusting the size based on the font.

    >> ...and to remove the edge?

    You'll have to do the drawing yourself if you don't like the default implementation.

    gg

    Yes,

    you need owner drawn control and then use WM_MEASUREITEM to return whatever you like.

    Igor

  8. #8
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    I made and forgot to send the results. The sources are annexed...

    bye

  9. #9
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    If it will have some irregularity, inform to me...

    bye

  10. #10
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    In the Windows XP, with any active theme, it's necessary create a "XP Manifest", to the good functioning...

    bye

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Is that a question or a statement?
    In any case, creating a manifest allows you to use the "pretty" new controls in XP. Otherwise it has not real significance.

  12. #12
    A.I Programmer
    Join Date
    Mar 2007
    Location
    Teresina - Brazil
    Posts
    47
    This is a statement... My English is very bad...

    bye

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM
  2. struct question
    By caduardo21 in forum Windows Programming
    Replies: 5
    Last Post: 01-31-2005, 04:49 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 07:35 PM