http://social.msdn.microsoft.com/forums/en-US/winforms/thread/e04e9308-bff5-4fbb-8cd6-0b2cd957aa68/?prof=requiredchanger le comportement natif de ComboBox - comboBox est hightlighted change lorsque sa taille
Selon un autre forum, ce n'est pas un problème MS, parce qu'ils disent que le comportement est le « natif » de la CombBox. Si le ComboBox a un DropDownStyle = DropDown et change sa taille, le texte est highligted, si le formulaire a ComboBox semble que les contrôles sont sélectionnés.
Pour éviter ce problème, un type suggère de remplacer le WndProc. Everthing fonctionnait très bien jusqu'à ce qu'un client a signalé une erreur non gérée
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)...............
classe ComboBoxEx: ComboBox { 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;
}
}
}
Je ne sais pas la raison pour laquelle cela se produit seulement avec un client. Une idée? Merci, luisnike19
Je don Je ne connais pas la réponse, mais vous devriez probablement ajouter une balise Windows Forms à cela. Pourrait aider à le faire devant les gens qui passent plus de temps sur ces questions. – Mallioch