/// <summary> /// Constructor /// </summary> public StringMatcher(StringMatchingMethod method, string pattern) { switch (method) { case StringMatchingMethod.NoWildcards: m_pattern = prepareNoWildcard(pattern); Match = buildNoWildcard; break; case StringMatchingMethod.UseWildcards: m_pattern = prepareWithWildcards(pattern); Match = buildWithWildcards; break; case StringMatchingMethod.UseWildcardsStartsWith: m_pattern = prepareWithWildcardsStartsWith(pattern); Match = buildWithWildcards; break; case StringMatchingMethod.UseRegexs: m_pattern = prepareRegex(pattern); Match = buildRegex; break; default: throw new ArgumentException("Unknown StringMatchingMethod value"); } }
/// <summary> /// constructor /// </summary> public EasyCompletionComboBox() { m_matchingMethod = StringMatchingMethod.NoWildcards; // we're overriding these DropDownStyle = ComboBoxStyle.DropDown; AutoCompleteMode = AutoCompleteMode.None; // let's build our suggestion list m_suggestionList = new ListBox { DisplayMember = "Text", TabStop = false, Dock = DockStyle.Fill, DrawMode = DrawMode.OwnerDrawFixed, IntegralHeight = true, Sorted = Sorted, }; m_suggestionList.Click += onSuggestionListClick; m_suggestionList.DrawItem += onSuggestionListDrawItem; FontChanged += onFontChanged; m_suggestionList.MouseMove += onSuggestionListMouseMove; m_dropDown = new DropdownControl(m_suggestionList); onFontChanged(null, null); }