http://social.msdn.microsoft.com/forums/en-US/winforms/thread/e04e9308-bff5-4fbb-8cd6-0b2cd957aa68/?prof=required改变组合框的原始行为 - 组合框在突出显示时改变其大小
根据另一个论坛,这不是一个MS的问题,因为他们说是CombBox的“原生”的行为。
如果ComboBox具有DropDownStyle = DropDown并更改其大小,则文本将高亮显示,如果窗体中有许多ComboBox似乎选择了该控件。
为了避免这个问题,一个人建议覆盖WndProc。 寄托都工作正常,直到仅有一个客户端报告了一个未处理的错误
System.ArgumentOutOfRangeException: InvalidArgument=Value of '-2136611475' is not valid for 'start'.
Parameter name: start
at System.Windows.Forms.ComboBox.Select(Int32 start, Int32 length)
at System.Windows.Forms.ComboBox.set_SelectionLength(Int32 value)...............
类ComboBoxEx:组合框 { const int的WM_SIZE = 5;
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case WM_SIZE:
string text = Text;
base.WndProc(ref m);
//The exception strangely is trown here
SelectionLength = 0;
Text = text;
break;
default:
base.WndProc(ref m);
break;
}
}
}
我不知道为什么这仅仅是一个客户端发生的原因。任何想法? 谢谢,luisnike19
我不不知道答案,但您应该为此添加一个窗体窗体标签。可以帮助在面对这些问题花更多时间的人面前。 – Mallioch 2009-07-29 16:27:51