0

Is there a way to decrease the ToolStripDropDown height from Top? I have a custom control that show a list of data when typing on it, the behavior is like TextBox with AutoCompleteMode.Suggest. When you type on it, the list will show and the ToolStripDown is decreasing height. This control used to search/filter data from Database. Then user can select it by clicking on the items or just press enter.

The problem is when the ToolStripDropDown reached the bottom of the screen, it overlaps the control use to input the text.

I want something like the ComboBox when the list reaches the bottom of screen, it display the list at the top. So for the control I am working, it will show the List at the top of the TextBox then decrease the ToolStripDropDown height so it will goes close to the TextBox.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Zhyke
  • 427
  • 7
  • 22

1 Answers1

0

Use the code below taken from here written by Paul Williams to get the current screen size. Then figure out where you need to redraw the dropdown from the top by getting the Height of the Dropdown using ToolStripDropDown.Size and ToolStripDropDown.Location

Form myForm;
Screen myScreen = Screen.FromControl(myForm);
Rectangle area = myScreen.WorkingArea
demoncrate
  • 390
  • 2
  • 14