private void txtBx_SymFilter_TextChanged(object sender, EventArgs e) { TextMatchFilter filter = null; if (rb_RegexFilter2.Checked) { filter = TextMatchFilter.Regex(olv_SymbolView, txtBx_SymFilter.Text); } else { filter = TextMatchFilter.Contains(olv_SymbolView, txtBx_SymFilter.Text); } olv_SymbolView.AdditionalFilter = filter; // Use a timer to have a single update for more than "text changed" event, better UX _timer.Stop(); // Stop an existing timer _timer.AutoReset = false; // one shot _timer.Enabled = true; _timer.Elapsed += (object s, ElapsedEventArgs e1) => { if (!_UIUpdateInProgress) { AddSumRow(olv_SymbolView.FilteredObjects.Cast <Symbol>().ToList()); olv_SymbolView.Invalidate(); } }; _timer.Start(); }
public void TimedFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } // Text highlighting requires at least a default renderer if (olv.DefaultRenderer == null) { olv.DefaultRenderer = new HighlightTextRenderer(filter); } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); olv.AdditionalFilter = filter; stopWatch.Stop(); }
public virtual void Test_TextFilter_FindAll_Regex_NoMatch() { TextMatchFilter filter = TextMatchFilter.Regex(this.olv, "[yz]+"); List <CharacterRange> ranges = new List <CharacterRange>(filter.FindAllMatchedRanges("x-abcd-ABCD")); Assert.AreEqual(0, ranges.Count); }
/// <summary> /// Called when you type something inside the text box above the main module list view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textBoxFilterSimple_TextChanged(object sender, EventArgs e) { // Use a timer to have a single update for more than one "text changed" event, better UX _moduleFilter.Restart(false, (object s, ElapsedEventArgs e1) => { BeginInvoke(new MethodInvoker(() => { TextMatchFilter filter = null; Debug.WriteLineIf(DEBUG, "Text Changed!"); if (rb_RegexFilter.Checked) { filter = TextMatchFilter.Regex(olv_ModuleView, textBoxFilterSimple.Text); } else { filter = TextMatchFilter.Contains(olv_ModuleView, textBoxFilterSimple.Text); } olv_ModuleView.AdditionalFilter = filter; if (!_UIUpdateInProgress) { AddSumRow(olv_ModuleView.FilteredObjects); PopulateSymbolLV(FilterSymbols(olv_ModuleView.FilteredObjects.Cast <Module>().ToList())); olv_ModuleView.Invalidate(); } })); }); }
public void TimedFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } olv.AdditionalFilter = filter; }
private void filterMods_TextChanged(object sender, EventArgs e) { TextMatchFilter filter = null; int matchKind = 0; string txt = ((TextBox)sender).Text; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(modlist_ListObjectListView, txt); break; case 1: filter = TextMatchFilter.Prefix(modlist_ListObjectListView, txt); break; case 2: filter = TextMatchFilter.Regex(modlist_ListObjectListView, txt); break; } } // Text highlighting requires at least a default renderer if (modlist_ListObjectListView.DefaultRenderer == null) { modlist_ListObjectListView.DefaultRenderer = new HighlightTextRenderer(filter); } modlist_ListObjectListView.AdditionalFilter = filter; }
public virtual void Test_TextFilter_Regex_Invalid() { this.olv.SetObjects(PersonDb.All); this.olv.UseFiltering = true; this.olv.ModelFilter = TextMatchFilter.Regex(this.olv, @"[\*"); Assert.AreEqual(PersonDb.All.Count, this.olv.GetItemCount()); }
void TimedFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } if (filter == null) { olv.DefaultRenderer = null; } else { olv.DefaultRenderer = new HighlightTextRenderer(filter); } HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); olv.ModelFilter = filter; stopWatch.Stop(); IList objects = olv.Objects as IList; if (objects == null) { this.toolStripStatusLabel1.Text = String.Format("Filtered in {0}ms", stopWatch.ElapsedMilliseconds); } else { this.toolStripStatusLabel1.Text = String.Format("Filtered {0} items down to {1} items in {2}ms", objects.Count, olv.Items.Count, stopWatch.ElapsedMilliseconds); } }
private void Find() { string[] txt = txtSearch.Text.Split('|').Select(x => x.Trim()).ToArray(); TextMatchFilter filter = null; switch (comboBoxFilterType.SelectedIndex) { case 0: default: filter = TextMatchFilter.Contains(listView, txt); break; case 1: filter = TextMatchFilter.Prefix(listView, txt); break; case 2: filter = TextMatchFilter.Regex(listView, txt); break; } listView.DefaultRenderer = new HighlightTextRenderer(filter); listView.AdditionalFilter = filter; IList objects = listView.Objects as IList; }
public static void FilterFOLV(FastObjectListView OLV, string FilterText, bool Filter) { using var cw = new Global_GUI.CursorWait(); try { if (!string.IsNullOrEmpty(FilterText)) { if (Filter) { OLV.UseFiltering = true; } else { OLV.UseFiltering = false; } TextMatchFilter filter = TextMatchFilter.Regex(OLV, FilterText); OLV.ModelFilter = filter; HighlightTextRenderer renderererer = new HighlightTextRenderer(filter); SolidBrush brush = renderererer.FillBrush as SolidBrush ?? new SolidBrush(Color.Transparent); brush.Color = System.Drawing.Color.FromArgb(100, Color.LightSeaGreen); // renderererer.FillBrush = brush; OLV.DefaultRenderer = renderererer; Global.SaveRegSetting("SearchText", FilterText); } else { OLV.ModelFilter = null; } OLV.Refresh(); //Application.DoEvents(); } catch { } }
/// <summary> /// Called when you type something inside the text box above the main module list view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textBoxFilterSimple_TextChanged(object sender, EventArgs e) { TextMatchFilter filter = null; if (rb_RegexFilter.Checked) { filter = TextMatchFilter.Regex(olv_ModuleView, textBoxFilterSimple.Text); } else { filter = TextMatchFilter.Contains(olv_ModuleView, textBoxFilterSimple.Text); } olv_ModuleView.AdditionalFilter = filter; AddSumRow(olv_ModuleView.FilteredObjects); foreach (var x in olv_ModuleView.FilteredObjects) { Debug.WriteLineIf(DEBUG, "Selected:" + ((Module)x).ModuleName); } // Use a timer to have a single update for more than one "text changed" event, better UX _timer.Stop(); // Stop an existing timer _timer.AutoReset = false; // one shot _timer.Enabled = true; _timer.Elapsed += (object s, ElapsedEventArgs e1) => { if (!_UIUpdateInProgress) { PopulateSymbolLV(FilterSymbols(olv_ModuleView.FilteredObjects.Cast <Module>().ToList())); olv_ModuleView.Invalidate(); } }; _timer.Start(); }
private void TimedFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!string.IsNullOrEmpty(txt)) { switch (matchKind) { default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } // Setup a default renderer to draw the filter matches olv.DefaultRenderer = filter == null ? null : new HighlightTextRenderer(filter); // Some lists have renderers already installed if (olv.GetColumn(0).Renderer is HighlightTextRenderer highlightingRenderer) { highlightingRenderer.Filter = filter; } olv.ModelFilter = filter; SetItemCount(); }
void Filter(FastObjectListView olv, string txt, int matchKind) { olv.OwnerDraw = true; TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } // Setup a default renderer to draw the filter matches if (filter == null) { olv.DefaultRenderer = null; olv.ModelFilter = null; } else { olv.DefaultRenderer = new HighlightTextRenderer(filter); olv.ModelFilter = filter; // Uncomment this line to see how the GDI+ rendering looks //olv.DefaultRenderer = new HighlightTextRenderer { Filter = filter, UseGdiTextRendering = false }; } // Some lists have renderers already installed HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } IList objects = olv.Objects as IList; if ((objects == null) || (objects.Count == olv.Items.Count)) { this.toolStripStatusLabel1.Text = string.Empty; } else { this.toolStripStatusLabel1.Text = String.Format("Filtered {0} items down to {1} items", objects.Count, olv.Items.Count); } }
private void FilterList(ObjectListView olv, string searchText, bool showMatching = false) { // Construct the regex to search for string[] SearchedString = searchText.Split('*'); StringBuilder regex = new StringBuilder(); //regex.Append(".*"); foreach (string term in SearchedString) { if (term != string.Empty && Array.IndexOf(SearchedString, term) == (SearchedString.Length - 1)) { regex.Append(term); } else { regex.Append(term + ".*"); } } regex.Append(".*"); System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("^" + regex.ToString() + "$", System.Text.RegularExpressions.RegexOptions.IgnoreCase & System.Text.RegularExpressions.RegexOptions.Multiline); TextMatchFilter filter = null; if (!string.IsNullOrEmpty(searchText)) { filter = TextMatchFilter.Regex(olv, r.ToString()); } if (showMatching) { // Setup a default renderer to draw the filter matches if (filter == null) { olv.DefaultRenderer = null; } else { olv.DefaultRenderer = new HighlightTextRenderer(filter); } // Some lists have renderers already installed HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } olv.AdditionalFilter = filter; } else { olv.DefaultRenderer = null; olv.AdditionalFilter = filter; } }
private void BUT_find_Click(object sender, EventArgs e) { string searchfor = ""; InputBox.Show("Search For", "Enter a single word to search for", ref searchfor); Params.UseFiltering = true; Params.ModelFilter = TextMatchFilter.Regex(this.Params, searchfor.ToLower()); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); }
public virtual void Test_TextFilter_Regex_CaseSensitive() { this.olv.SetObjects(PersonDb.All); this.olv.UseFiltering = true; TextMatchFilter filter = TextMatchFilter.Regex(this.olv, "Z+"); filter.StringComparison = StringComparison.CurrentCulture; this.olv.ModelFilter = filter; Assert.AreEqual(0, this.olv.GetItemCount()); }
void filterList(string searchfor) { if (searchfor.Length >= 2 || searchfor.Length == 0) { Params.UseFiltering = false; Params.ModelFilter = TextMatchFilter.Regex(Params, searchfor.ToLower()); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); Params.UseFiltering = true; } }
void TimedFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } // Setup a default renderer to draw the filter matches olv.DefaultRenderer = filter == null ? null : new HighlightTextRenderer(filter); // Some lists have renderers already installed HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); olv.AdditionalFilter = filter; //olv.Invalidate(); stopWatch.Stop(); IList objects = olv.Objects as IList; if (objects == null) { toolStripStatusLabel1.Text = String.Format("Filtered in {0}ms", stopWatch.ElapsedMilliseconds); } else { toolStripStatusLabel1.Text = String.Format("在 {0} 条数据中过滤出符合条件的 {1} 数据,耗时{2}ms", objects.Count, olv.Items.Count, stopWatch.ElapsedMilliseconds); } }
public virtual void Test_TextFilter_FindAll_Regex_Multiple() { TextMatchFilter filter = TextMatchFilter.Regex(this.olv, "x.*z", "a.*c"); List <CharacterRange> ranges = new List <CharacterRange>(filter.FindAllMatchedRanges("rst-ABC-rst-xyz")); Assert.AreEqual(2, ranges.Count); Assert.AreEqual(12, ranges[0].First); Assert.AreEqual(3, ranges[0].Length); Assert.AreEqual(4, ranges[1].First); Assert.AreEqual(3, ranges[1].Length); }
public void TimedFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } // Text highlighting requires at least a default renderer if (olv.DefaultRenderer == null) { olv.DefaultRenderer = new HighlightTextRenderer(filter); } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); olv.AdditionalFilter = filter; //olv.Invalidate(); stopWatch.Stop(); IList objects = olv.Objects as IList; if (objects == null) { this.ToolStripStatus1 = prefixForNextSelectionMessage = String.Format("Filtered in {0}ms", stopWatch.ElapsedMilliseconds); } else { this.ToolStripStatus1 = prefixForNextSelectionMessage = String.Format("Filtered {0} items down to {1} items in {2}ms", objects.Count, olv.Items.Count, stopWatch.ElapsedMilliseconds); } }
void filterList(string searchfor) { if (searchfor.Length >= 2 || searchfor.Length == 0) { var expanded = Params.ExpandedObjects.OfType <object>().Where((o, i) => { var count = Params.VirtualListDataSource.GetObjectCount(); for (int a = 0; a < count; a++) { var obj = Params.VirtualListDataSource.GetNthObject(a); if (obj == o) { return(true); } } return(false); }).ToArray(); Params.Visible = false; Params.UseFiltering = false; Params.ExpandAll(); Params.ModelFilter = TextMatchFilter.Regex(Params, searchfor.Replace("*", ".*").Replace("..*", ".*").ToLower()); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); Params.UseFiltering = true; if (Params.Items.Count > 0) { if (searchfor.Length == 0) { Params.CollapseAll(); } foreach (var row in expanded) { Params.Expand(row); } } Params.Visible = true; } if (chk_modified.Checked) { var filter = String.Format("({0})", String.Join("|", _changes.Keys.Select(a => a.ToString()))); Params.ModelFilter = TextMatchFilter.Regex(Params, filter); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); Params.UseFiltering = true; } }
public virtual void Test_TextFilter_FindAll_Regex() { TextMatchFilter filter = TextMatchFilter.Regex(this.olv, "[abcd]+"); List <CharacterRange> ranges = new List <CharacterRange>(filter.FindAllMatchedRanges("nada-abcd-ab-ABCD")); Assert.AreEqual(4, ranges.Count); Assert.AreEqual(1, ranges[0].First); Assert.AreEqual(3, ranges[0].Length); Assert.AreEqual(5, ranges[1].First); Assert.AreEqual(4, ranges[1].Length); Assert.AreEqual(10, ranges[2].First); Assert.AreEqual(2, ranges[2].Length); Assert.AreEqual(13, ranges[3].First); Assert.AreEqual(4, ranges[3].Length); }
private static TextMatchFilter createTextMatchFilter(ObjectListView olv, string[] filterTexts, int matchKind) { switch (matchKind) { case 0: default: return(TextMatchFilter.Contains(olv, filterTexts)); case 1: return(TextMatchFilter.Prefix(olv, filterTexts)); case 2: return(TextMatchFilter.Regex(olv, filterTexts)); } }
public static void OLVFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } // Setup a default renderer to draw the filter matches if (filter == null) { olv.DefaultRenderer = null; } else { olv.DefaultRenderer = new HighlightTextRenderer(filter); // Uncomment this line to see how the GDI+ rendering looks //olv.DefaultRenderer = new HighlightTextRenderer { Filter = filter, UseGdiTextRendering = false }; } // Some lists have renderers already installed HighlightTextRenderer highlightingRenderer = olv.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } olv.AdditionalFilter = filter; //olv.Invalidate(); }
private void TimedFilter(ObjectListView folv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Prefix(folv, txt); break; case 1: filter = TextMatchFilter.Contains(folv, txt); break; case 2: filter = TextMatchFilter.Regex(folv, txt); break; } } // Setup a default renderer to draw the filter matches if (filter == null) { folv.DefaultRenderer = null; } else { folv.DefaultRenderer = new HighlightTextRenderer(filter); } // Some lists have renderers already installed HighlightTextRenderer highlightingRenderer = folv.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); folv.ModelFilter = filter; stopWatch.Stop(); }
/// <summary> /// Called when you type something inside the text box above the symbols/details view. /// Depending on the selected tab, either the dependency tree or symbol list will be filtered /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtBx_SymFilter_TextChanged(object sender, EventArgs e) { if (_UIUpdateInProgress) { return; } TextMatchFilter filter = null; _symFilter.Restart(false, (object s, ElapsedEventArgs e1) => { BeginInvoke(new MethodInvoker(() => { if (tab_details.SelectedIndex == 0) { if (rb_RegexFilter2.Checked) { filter = TextMatchFilter.Regex(olv_SymbolView, txtBx_SymFilter.Text); } else { filter = TextMatchFilter.Contains(olv_SymbolView, txtBx_SymFilter.Text); } olv_SymbolView.AdditionalFilter = filter; AddSumRow(olv_SymbolView.FilteredObjects.Cast <Symbol>().ToList()); olv_SymbolView.Invalidate(); } else // dependency view { if (rb_RegexFilter2.Checked) { filter = TextMatchFilter.Regex(olv_Cref, txtBx_SymFilter.Text); } else { filter = TextMatchFilter.Contains(olv_Cref, txtBx_SymFilter.Text); } olv_Cref.AdditionalFilter = filter; } })); }); }
public void TimeFilter(String aFilterStr, FilterType aType) { TextMatchFilter nFilter = null; if (!String.IsNullOrEmpty(aFilterStr)) { switch (aType) { default: case FilterType.CONTAINS: nFilter = TextMatchFilter.Contains(this, aFilterStr); break; case FilterType.PREFIX: nFilter = TextMatchFilter.Prefix(this, aFilterStr); break; case FilterType.REGEX: nFilter = TextMatchFilter.Regex(this, aFilterStr); break; } } if (nFilter == null) { this.DefaultRenderer = null; } else { this.DefaultRenderer = new HighlightTextRenderer(nFilter); } // Some lists have renderers already installed HighlightTextRenderer highlightingRenderer = this.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = nFilter; } this.AdditionalFilter = nFilter; }
void filterList(string searchfor) { if (searchfor.Length >= 2 || searchfor.Length == 0) { var expanded = Params.ExpandedObjects.OfType <object>().Where((o, i) => { var count = Params.VirtualListDataSource.GetObjectCount(); for (int a = 0; a < count; a++) { var obj = Params.VirtualListDataSource.GetNthObject(a); if (obj == o) { return(true); } } return(false); }).ToArray(); Params.Visible = false; Params.UseFiltering = false; Params.ExpandAll(); Params.ModelFilter = TextMatchFilter.Regex(Params, searchfor.ToLower()); Params.DefaultRenderer = new HighlightTextRenderer((TextMatchFilter)Params.ModelFilter); Params.UseFiltering = true; if (Params.Items.Count > 0) { if (searchfor.Length == 0) { Params.CollapseAll(); } foreach (var row in expanded) { Params.Expand(row); } } Params.Visible = true; } }
private void TimedFilter(ObjectListView olv, string txt, int matchKind) { TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(olv, txt); break; case 1: filter = TextMatchFilter.Prefix(olv, txt); break; case 2: filter = TextMatchFilter.Regex(olv, txt); break; } } if (filter == null) { olv.DefaultRenderer = null; } else { olv.DefaultRenderer = new HighlightTextRenderer(filter); olv.DefaultRenderer = new HighlightTextRenderer { Filter = filter, UseGdiTextRendering = true }; } System.Diagnostics.Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); olv.ModelFilter = filter; stopWatch.Stop(); }
private void materialSingleLineTextField3_TextChanged(object sender, EventArgs e) { string txt = materialSingleLineTextField3.Text; //Debug.WriteLine("过滤: " + txt); int matchKind = comboBox4.SelectedIndex; TextMatchFilter filter = null; if (!String.IsNullOrEmpty(txt)) { switch (matchKind) { case 0: default: filter = TextMatchFilter.Contains(fastObjectListView1, txt); break; case 1: filter = TextMatchFilter.Prefix(fastObjectListView1, txt); break; case 2: filter = TextMatchFilter.Regex(fastObjectListView1, txt); break; } } if (filter == null) { fastObjectListView1.DefaultRenderer = null; } else { fastObjectListView1.DefaultRenderer = new HighlightTextRenderer(filter); // 可以选择GDI渲染高亮 //fastObjectListView1.DefaultRenderer = new HighlightTextRenderer { Filter = filter, UseGdiTextRendering = false }; } // 如果使用了其他过滤器 HighlightTextRenderer highlightingRenderer = fastObjectListView1.GetColumn(0).Renderer as HighlightTextRenderer; if (highlightingRenderer != null) { highlightingRenderer.Filter = filter; } Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); fastObjectListView1.AdditionalFilter = filter; stopWatch.Stop(); IList objects = fastObjectListView1.Objects as IList; if (objects == null) { SetTips(String.Format("过滤完成, 消耗 {0} 毫秒", stopWatch.ElapsedMilliseconds)); } else { SetTips(String.Format("过滤完成, 总元素数量 {0} , 过滤后元素数量 {1} ,消耗 {2} 毫秒", objects.Count, fastObjectListView1.Items.Count, stopWatch.ElapsedMilliseconds)); } fastObjectListView1.Invalidate(); //Debug.WriteLine("过滤: " + txt + " 完毕."); }