. Resize. , - , , , , . ( , ComboBox; , , , , , ComboBox.)
comboBox.Resize += (s, e) => {
if (!comboBox.IsHandleCreated)
return; // avoid possible exception
comboBox.BeginInvoke(new Action(() => comboBox.SelectionLength = 0));
};
, , ? , , -, Resize, Resize , . ( , , , .)
BeginInvoke , Resize , IsHandleCreated , BeginInvoke .
, , . , , , , .
comboBox.Resize += (s, e) => {
if (!comboBox.IsHandleCreated)
return;
comboBox.BeginInvoke(new Action(() => {
var parent = comboBox.FindForm();
if (parent == null)
return;
if (parent.ActiveControl == null)
return;
if (parent.ActiveControl == comboBox)
return;
comboBox.SelectionLength = 0;
}));
};
, "" , , . Resize , BeginInvoke , . Queue Stack, ( , , ).