I'm working with a DataGridView, containing DataGridViewTextBoxColumns and DataGridViewComboBoxColumns. The issue is with the DropDown list of the ComboBox columns. The DropDown flow is restricted by the bounds of the screen, but my goal is for it to be restricted by bounds of the window instead.
By default, the DropDown will flow outside of the window if there is room for it; this is the issue. I need the DropDown to always stay inside the bounds of the window.
Example code for one of the ComboBox columns:
DataGridViewComboBoxColumn combo1 = new DataGridViewComboBoxColumn
{
DataSource = Main.dsUtility.Tables["Statuses"],
DataPropertyName = "Status",
ValueMember = "StatusCode",
DisplayMember = "StatusName",
HeaderText = "Status",
Name = "Status",
SortMode = DataGridViewColumnSortMode.Automatic,
FillWeight = 1.5f,
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing,
DisplayIndex = 1,
DropDownWidth = 125,
FlatStyle = FlatStyle.System
};
dgv.Columns.Add(combo1);
Below are images that illustrate the DropDown flowing outside/inside the application window.