Как установить/построить listview filterbar vs2019 winform C#
Как мне подать заявку/построить
listView
filterbar
с помощью C# в vs2019Нужна расширенная функциональность фильтровать ListView с-строке каждого столбца, так как использование и GT;, на<,&ГТ;=,=&ЛТ;, существует, между и др.
Фильтр с поиском и просмотр строк с условием фильтра.
Please see images---link below... https://ibb.co/2sLVrpD https://ibb.co/hKdWRDn
[Кнопка фильтра столбца ListView и поле не работают...]
Заранее благодарю вас.
TestListViewFilter.в CS
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace TestListViewFilter { /// <summary> /// Summary description for Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button4; private System.Windows.Forms.ColumnHeader columnHeader1; private System.Windows.Forms.ColumnHeader columnHeader2; private System.Windows.Forms.ColumnHeader columnHeader3; private ListViewFilter.ListViewFilter listViewFilter1; private System.Windows.Forms.Button button5; private System.Windows.Forms.ToolTip toolTip1; private Button button6; private System.ComponentModel.IContainer components; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); this.toolTip1.SetToolTip( this.button1, "Create some items to test" ); this.toolTip1.SetToolTip( this.button2, "Toggle filters mode" ); this.toolTip1.SetToolTip( this.button3, "Get the filter data of the sorted column" ); this.toolTip1.SetToolTip( this.button4, "Set the filter for the sorted column" ); this.toolTip1.SetToolTip( this.button5, "Set default format and alignment" ); this.toolTip1.SetToolTip( this.textBox1, "Text from/for the sorted column filter" ); } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.panel1 = new System.Windows.Forms.Panel(); this.button5 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button3 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.listViewFilter1 = new ListViewFilter.ListViewFilter(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.button6 = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.Controls.Add(this.button6); this.panel1.Controls.Add(this.button5); this.panel1.Controls.Add(this.button4); this.panel1.Controls.Add(this.textBox1); this.panel1.Controls.Add(this.button3); this.panel1.Controls.Add(this.button2); this.panel1.Controls.Add(this.button1); this.panel1.Dock = System.Windows.Forms.DockStyle.Left; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(87, 375); this.panel1.TabIndex = 0; // // button5 // this.button5.FlatStyle = System.Windows.Forms.FlatStyle.System; this.button5.Location = new System.Drawing.Point(12, 152); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(63, 20); this.button5.TabIndex = 5; this.button5.Text = "Reset"; this.button5.Click += new System.EventHandler(this.button5_Click); // // button4 // this.button4.FlatStyle = System.Windows.Forms.FlatStyle.System; this.button4.Location = new System.Drawing.Point(13, 125); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(63, 20); this.button4.TabIndex = 4; this.button4.Text = "Set"; this.button4.Click += new System.EventHandler(this.button4_Click); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(13, 97); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(63, 20); this.textBox1.TabIndex = 3; this.textBox1.Text = "(filter value)"; // // button3 // this.button3.FlatStyle = System.Windows.Forms.FlatStyle.System; this.button3.Location = new System.Drawing.Point(13, 69); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(63, 20); this.button3.TabIndex = 2; this.button3.Text = "Get"; this.button3.Click += new System.EventHandler(this.button3_Click); // // button2 // this.button2.FlatStyle = System.Windows.Forms.FlatStyle.System; this.button2.Location = new System.Drawing.Point(13, 42); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(63, 20); this.button2.TabIndex = 1; this.button2.Text = "Filters"; this.button2.Click += new System.EventHandler(this.button2_Click); // // button1 // this.button1.FlatStyle = System.Windows.Forms.FlatStyle.System; this.button1.Location = new System.Drawing.Point(13, 14); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(63, 20); this.button1.TabIndex = 0; this.button1.Text = "Populate"; this.button1.Click += new System.EventHandler(this.button1_Click); // // columnHeader1 // this.columnHeader1.Text = "Strings"; this.columnHeader1.Width = 85; // // columnHeader2 // this.columnHeader2.Text = "Numbers"; this.columnHeader2.Width = 80; // // columnHeader3 // this.columnHeader3.Text = "Dates"; this.columnHeader3.Width = 100; // // listViewFilter1 // this.listViewFilter1.AllowColumnReorder = true; this.listViewFilter1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader1, this.columnHeader2, this.columnHeader3}); this.listViewFilter1.Filtered = true; this.listViewFilter1.Location = new System.Drawing.Point(87, 0); this.listViewFilter1.Name = "listViewFilter1"; this.listViewFilter1.ShadeColor = System.Drawing.Color.WhiteSmoke; this.listViewFilter1.Size = new System.Drawing.Size(409, 271); this.listViewFilter1.SortOrder = true; this.listViewFilter1.TabIndex = 1; this.listViewFilter1.UseCompatibleStateImageBehavior = false; this.listViewFilter1.View = System.Windows.Forms.View.Details; // // button6 // this.button6.FlatStyle = System.Windows.Forms.FlatStyle.System; this.button6.Location = new System.Drawing.Point(13, 282); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(63, 20); this.button6.TabIndex = 6; this.button6.Text = "Form"; this.button6.Click += new System.EventHandler(this.button6_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(629, 375); this.Controls.Add(this.listViewFilter1); this.Controls.Add(this.panel1); this.Name = "Form1"; this.Text = "Test ListViewFilter Control"; this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.ResumeLayout(false); } #endregion /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void button1_Click(object sender, System.EventArgs e) { listViewFilter1.BeginUpdate(); listViewFilter1.Items.Clear(); ListViewItem i; i = listViewFilter1.Items.Add( "AB" ); i.SubItems.Add( "5.3" ); i.SubItems.Add( "Jan 29, 1958" ); i = listViewFilter1.Items.Add( "abc" ); i.SubItems.Add( "2" ); i.SubItems.Add( "April 15, 2003" ); i = listViewFilter1.Items.Add( "BCDE" ); i.SubItems.Add( "15.25" ); i.SubItems.Add( "Dec 31, 1999" ); i = listViewFilter1.Items.Add( "CDE" ); i.SubItems.Add( "12" ); i.SubItems.Add( "Mar 15, 0012" ); listViewFilter1.EndUpdate(); } private void button2_Click(object sender, System.EventArgs e) { listViewFilter1.Filtered = !listViewFilter1.Filtered; } private void button3_Click(object sender, System.EventArgs e) { textBox1.Text = listViewFilter1.Header.Filter[ listViewFilter1.SortColumn ]; } private void button4_Click(object sender, System.EventArgs e) { listViewFilter1.Header.Filter[ listViewFilter1.SortColumn ] = textBox1.Text; } private void button5_Click(object sender, System.EventArgs e) { listViewFilter1.SortColumn = 0; listViewFilter1.SortOrder = true; listViewFilter1.Filtered = true; listViewFilter1.Header.DataType[ 0 ] = ListViewFilter.LVFDataType.String; listViewFilter1.Header.DataType[ 1 ] = ListViewFilter.LVFDataType.Number; listViewFilter1.Header.DataType[ 2 ] = ListViewFilter.LVFDataType.Date; listViewFilter1.Header.Alignment[ 0 ] = HorizontalAlignment.Left; listViewFilter1.Header.Alignment[ 1 ] = HorizontalAlignment.Right; listViewFilter1.Header.Alignment[ 2 ] = HorizontalAlignment.Center; listViewFilter1.Header.Filter[ 0 ] = ""; listViewFilter1.Header.Filter[ 1 ] = ""; listViewFilter1.Header.Filter[ 2 ] = ""; } private void button6_Click(object sender, EventArgs e) { Form frm = new Form2(); frm.Show(); } } }
Работа со ссылками
ListViewFilter
Что я уже пробовал:
ListViewFilter_src.zip - Google Диск[^]
Richard MacCutchan
В чем именно заключается проблема?
IT_i
Кнопка фильтра столбца ListView и поле не работают...
Пожалуйста, смотрите изображения---ссылка ниже...
https://ibb.co/2sLVrpD
https://ibb.co/hKdWRDn
Richard MacCutchan
Извините, но если вам нужна помощь, то вам нужно предоставить полную информацию о вашей проблеме в вопросе. И сказать: "не работает" - это совсем не поможет; мы не можем догадаться, что это может означать.
IT_i
Теперь мой значок фильтра боковых столбцов и окно фильтра щелкают не работает.
Ссылка На Проект:
https://drive.google.com/file/d/1Ui-e2SmY5nyv2vlc-loYv4RfLYbrTC0g/view?usp=sharing
Richard MacCutchan
Человек, написавший статью (Элемент управления ListViewFilter для .NET[^]) не был активен здесь уже более 15 лет. Так что вряд ли вы получите большую помощь в этом.