Editbox portion of ComboBox gets selected automatically

后端 未结 7 1262
隐瞒了意图╮
隐瞒了意图╮ 2020-12-30 02:49

I have a small problem that has been annoying me for some hours.

In my WinForms (.NET 3.5) application I create some ComboBoxes (DropDownStyle = DropDown) in a Table

7条回答
  •  难免孤独
    2020-12-30 03:17

    This appears to be a bug in the native Windows implementation of ComboBox with DropDownStyle of DropDown.

    The fix detailed in the other answers here (setting the SelectionLength property to 0 (zero) in the ComboBox's Resize event) works well most of the time.

    However, I found that even that fix to work around this bug does not always work. If the ComboBox is in a TableLayoutPanel, and if that TableLayoutPanel has more than one column with a Percent Size Type, then that fix often does not work.

    A picture is worth a thousand words. See the following screen shot of a form I made to demonstrate the problem.

提交回复
热议问题