10/03/11 20:32:55
>>438
ためしにやってみたが、リストボックスにフォーカスを合わすと、インクリメンタルサーチができなくなって…エディットぼっくにフォーカスを合わせたままだと、リストボックスの選択項目をキーボードで操作できなくなって…となった。
フォームの初期化時
this.autocomplete_box.Visible = false;
this.Controls.Add(this.autocomplete_box);
文字を入力した
this.input_word += e.KeyChar;
int index = this.autocomplete_box.FindString(this.input_word.ToString());
if (index != ListBox.NoMatches)
{
Point current = this.GetPositionFromCharIndex(this.SelectionStart);
this.autocomplete_box.SelectedIndex = index;
this.autocomplete_box.Location = new Point(current.X, current.Y + this.Font.Height);
this.autocomplete_box.Visible = true;
}