オートコンプリートに使用される補完文字列のソースを指定する値を取得または設定します(
System.Windows.Forms.ComboBox.AutoCompleteSource を参照)。
次のサンプルコードは、ComboBox 型セルの動作または外観をカスタマイズする方法を示します。このサンプルコードは、
CalendarComboBoxCellType クラスに示されている詳細なコード例の一部を抜粋したものです。
CalendarComboBoxCellType CreateAutoCompleteComboBoxCell()
{
CalendarComboBoxCellType comboBoxCell = new CalendarComboBoxCellType();
comboBoxCell.DropDownStyle = CalendarGridComboBoxStyle.DropDown;
comboBoxCell.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
comboBoxCell.AutoCompleteSource = AutoCompleteSource.CustomSource;
string[] customSourceItems = new string[] { "aaa", "bbb", "ccc", "ddd" };
comboBoxCell.AutoCompleteCustomSource.AddRange(customSourceItems);
comboBoxCell.Items.Add("(none)");
comboBoxCell.Items.Add("aaa");
comboBoxCell.Items.Add("bbb");
comboBoxCell.Items.Add("ccc");
comboBoxCell.Items.Add("ddd");
return comboBoxCell;
}
Private Function CreateAutoCompleteComboBoxCell() As CalendarComboBoxCellType
Dim comboBoxCell As New CalendarComboBoxCellType()
comboBoxCell.DropDownStyle = CalendarGridComboBoxStyle.DropDown
comboBoxCell.AutoCompleteMode = AutoCompleteMode.SuggestAppend
comboBoxCell.AutoCompleteSource = AutoCompleteSource.CustomSource
Dim customSourceItems As String() = New String() {"aaa", "bbb", "ccc", "ddd"}
comboBoxCell.AutoCompleteCustomSource.AddRange(customSourceItems)
comboBoxCell.Items.Add("(none)")
comboBoxCell.Items.Add("aaa")
comboBoxCell.Items.Add("bbb")
comboBoxCell.Items.Add("ccc")
comboBoxCell.Items.Add("ddd")
Return comboBoxCell
End Function