locked
ComboBox Height (Windows Programming) RRS feed

  • Question

  • 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...

    Friday, November 30, 2007 2:31 PM

All replies

  • Interesting problem. I wouldn't recommend overriding wndproc() for this. I tried it that way and got many wierd errors. Maybe you might have better luck with it. Assuming you are coding in C#, I solved the problem by a simple P/Invoke to user32:

    Code Block

    using System.Runtime.InteropServices;

     

    const Int32 COMBOBOX_HEIGHTCONST = 0X153;

     

    [DllImport("user32.dll")]

    private static extern int SendMessage(IntPtr hwnd, Int32 wMsg, Int32 wParam, Int32 lParam);

     

    private void AdjustComboBoxHeight(ComboBox control, Int32 height)

    {

    SendMessage(control.Handle, COMBOBOX_HEIGHTCONST, -1, height);

    control.Refresh();

    }

     

    P.S I know the colors are messed up. I don't use the default VS colour schemes. I have a dark background.

    Sunday, December 2, 2007 7:28 AM
  • these 2 articles should help you..

    i tried for myself ..also didnt worked for me..

    but this thing reely worked..

    http://www.devx.com/vb2themax/Tip/19235

    http://www.pcreview.co.uk/forums/thread-1313097.php

    Monday, December 3, 2007 3:23 PM