views:

55

answers:

1

Hello Community,

i've a problem with the height of the System.Windows.Forms.Combobox-Control. I can't change it. I want to use that to write an own implementation (owner drawn custom control).

The following code does not work for me (It's only to try). The height is still 21px!

public class TestBox : ComboBox
{
    public TestBox()
    {
        DropDownHeight = 15;
    }

    protected override Size DefaultSize
    {
        get
        {
            return new Size(15,15);
        }
    }

    protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
    {
        base.SetBoundsCore(x, y, 15, 15, specified);
    }
}

Please help me.

Regars, Marco

+2  A: 

The ComboBox height should be resized based on the font that is assigned to it.

So, change the combo font. see another discussion on this subject.

ComboBox's MinimumSize property is coded like this:

public override Size MinimumSize
{
    get
    {
        return base.MinimumSize;
    }
    set
    {
        // can see that Height is not taken in consideration - is 0
        base.MinimumSize = new Size(value.Width, 0); 
    }
}
serhio
Ok... the answer for my question is definitly no! If you do not want to change the font size!
70sCommander