如下git所示的一样,控件第一次输入的时候,总是会自动少一个字。而我第二次输入的时候,又是正常的了。从昨天下午到现在一直在看问题,但是在网上找了很久,也没有找到对应问题和解决方案。gif中,上面的我用的是一个控件库里的控件。下面那个是原生的控件。都有一样的问题。
以下是Update事件的代码
private void comboBox_BigscaleUserTest_TextUpdate(object sender, EventArgs e)
{
try
{
this.comboBox_BigscaleUserTest.Items.Clear();
List<string> bigUsers = new List<string>();
foreach (string value in AttributeItems.strs_BigScaleUsers)
{
if (value.Contains(comboBox_BigscaleUserTest.Text))
{
bigUsers.Add(value);
}
}
comboBox_BigscaleUserTest.Items.AddRange(bigUsers.ToArray());
this.comboBox_BigscaleUserTest.SelectionStart = this.comboBox_BigscaleUserTest.Text.Length;
Cursor = Cursors.Default;
this.comboBox_BigscaleUserTest.DroppedDown = true;
}
catch (Exception ex)
{
CommonFunc.PopupErrorMsg("下拉框出错" + ex.Message);
}
}
以下是控件的属性设置情况
this.chB_BigScaleUsers.BackColor = System.Drawing.Color.Linen;
this.chB_BigScaleUsers.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.chB_BigScaleUsers.FormattingEnabled = true;
this.chB_BigScaleUsers.Location = new System.Drawing.Point(87, 228);
this.chB_BigScaleUsers.Name = "chB_BigScaleUsers";
this.chB_BigScaleUsers.Size = new System.Drawing.Size(362, 25);
this.chB_BigScaleUsers.TabIndex = 6;
this.chB_BigScaleUsers.TextChanged += new System.EventHandler(this.chB_BigScaleUsers_TextUpdate);
如果有知道的小伙伴万望告知