namespace Yw.WinFrmUI { /// /// /// public partial class GeneralSearchAndSetSelectCtrl : DevExpress.XtraEditors.XtraUserControl { /// /// /// public GeneralSearchAndSetSelectCtrl() { InitializeComponent(); this.layoutControl1.SetupLayoutControl(); } /// /// 搜索 /// public event Action SearchEvent; /// /// 清空 /// public event Action ClearEvent; /// /// 设置 /// public event Action SetEvent; /// /// 选择 /// public event Action SelectEvent; //搜索 清空 private void buttonEditSearch_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { var tag_obj = e.Button.Tag; if (tag_obj is string tag) { SetClickEvent(tag); } } //设置 private void buttonEditSet_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { var tag_obj = e.Button.Tag; if (tag_obj is string tag) { SetClickEvent(tag); } } //点击 private void SetClickEvent(string tag) { switch (tag) { case "Search": { this.SearchEvent?.Invoke(); } break; case "Clear": { this.ClearEvent?.Invoke(); } break; case "Set": { this.SetEvent?.Invoke(); } break; case "Select": { this.SelectEvent?.Invoke(); } break; default: break; } } } }