zreecu
zreecu

Reputation: 41

Combobox dropdown list is going below the window screen.

I am using a DatagridView in which I have some 16 rows with each row having a combobox in it. The problem arise when I try to drop down the combobox in the bottom most row which has around 20- 30 items in it. The scroll bar in the dropdown disappears and the dropdown goes below the windows screen area. Any possible solution for it so the dropdown opens to the top. Framework 2.0.

Upvotes: 2

Views: 1953

Answers (1)

Tergiver
Tergiver

Reputation: 14517

I am unable to duplicate the problem. I tried moving this window around and opening various combo boxes. If it doesn't fit to drop down, it drops up, therefore being entirely on screen.

using System;
using System.Linq;
using System.Windows.Forms;

class MainForm : Form
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new MainForm());
    }

    public MainForm()
    {
        string[] comboSource = Enumerable.Range(1, 30).Select(i => String.Format("Item #{0}", i)).ToArray();

        Controls.Add(new DataGridView
        {
            AutoGenerateColumns = false,
            Columns = { new DataGridViewComboBoxColumn { HeaderText = "Item", DataSource = comboSource }, },
            DataSource = comboSource, // just adding dummy items for effect
            Dock = DockStyle.Fill,
        });
    }
}

Can you produce a similarly simple example that does duplicate the problem?

Upvotes: 1

Related Questions