* UIComboDataGridView: 增加FilterChanged,输出过滤文字和记录条数

This commit is contained in:
Sunny 2022-06-19 10:26:58 +08:00
parent fb3a35eee1
commit 60b942b047
3 changed files with 32 additions and 0 deletions

View File

@ -15,6 +15,8 @@ namespace Sunny.UI
private UISymbolButton btnClear; private UISymbolButton btnClear;
private UIDataGridView dataGridView; private UIDataGridView dataGridView;
public event OnComboDataGridViewFilterChanged ComboDataGridViewFilterChanged;
public UIComboDataGridViewItem() public UIComboDataGridViewItem()
{ {
InitializeComponent(); InitializeComponent();
@ -364,6 +366,8 @@ namespace Sunny.UI
{ {
table.DefaultView.RowFilter = filter; table.DefaultView.RowFilter = filter;
} }
ComboDataGridViewFilterChanged?.Invoke(this, new UIComboDataGridViewArgs(edtFilter.Text, dataGridView.RowCount));
} }
private void btnClear_Click(object sender, System.EventArgs e) private void btnClear_Click(object sender, System.EventArgs e)

View File

@ -201,4 +201,23 @@ namespace Sunny.UI
itemForm.SetStyle(style); itemForm.SetStyle(style);
} }
} }
public delegate void OnComboDataGridViewFilterChanged(object sender, UIComboDataGridViewArgs e);
public class UIComboDataGridViewArgs : EventArgs
{
public string FilterText { get; set; }
public int FilterCount { get; set; }
public UIComboDataGridViewArgs()
{
}
public UIComboDataGridViewArgs(string filterText, int filterCount)
{
FilterText = filterText;
FilterCount = filterCount;
}
}
} }

View File

@ -21,6 +21,7 @@
* 2022-03-22: V3.1.1 * 2022-03-22: V3.1.1
* 2022-04-16: V3.1.3 * 2022-04-16: V3.1.3
* 2022-06-16: V3.2.0 * 2022-06-16: V3.2.0
* 2022-06-19: V3.2.0 FilterChanged
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -52,6 +53,8 @@ namespace Sunny.UI
DropDownHeight = 300; DropDownHeight = 300;
} }
public event OnComboDataGridViewFilterChanged FilterChanged;
[DefaultValue(500)] [DefaultValue(500)]
[Description("下拉框宽度"), Category("SunnyUI")] [Description("下拉框宽度"), Category("SunnyUI")]
public int DropDownWidth { get; set; } public int DropDownWidth { get; set; }
@ -70,6 +73,12 @@ namespace Sunny.UI
item.Translate(); item.Translate();
//ItemForm.Show(this); //ItemForm.Show(this);
ItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, DropDownHeight)); ItemForm.Show(this, new Size(DropDownWidth < Width ? Width : DropDownWidth, DropDownHeight));
item.ComboDataGridViewFilterChanged += Item_ComboDataGridViewFilterChanged;
}
private void Item_ComboDataGridViewFilterChanged(object sender, UIComboDataGridViewArgs e)
{
FilterChanged?.Invoke(this, e);
} }
[DefaultValue(typeof(Size), "320, 240"), Description("下拉弹框界面大小"), Category("SunnyUI")] [DefaultValue(typeof(Size), "320, 240"), Description("下拉弹框界面大小"), Category("SunnyUI")]