テキストボックスにカスタム自動ソースを使用しています。しかし、問題は、キーを入力しているときに、提案リストが高い場合、提案を表示する前にテキストボックスがちらつくことです。
private void txtSearch_TextChanged(object sender, EventArgs e)
{
if (txtSearch.Text != "")
{
string templateSearchTxt = txtSearch.Text;
foreach (String template in templateName) // templateName contains list of string
{
if (template.ToUpper().StartsWith(templateSearchTxt.ToUpper()))
{
suggestion.Add(template);
}
}
}
}
フォームロードイベントで次のコードを宣言しました
suggestion = new AutoCompleteStringCollection();
txtSearch.AutoCompleteCustomSource = suggestion;
txtSearch.AutoCompleteMode = AutoCompleteMode.Suggest;
txtSearch.AutoCompleteSource = AutoCompleteSource.CustomSource;