/****************************** * 说明:自动搜索框弹出框 * 创建人:龚宇超 * 创建日期:2018-03-15 * 修改人: * 修改日期: * 修改备注: * 版本:1.0.0.0 ******************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using DevExpress.XtraGrid.Views.Grid; using DevExpress.Utils; using DevExpress.XtraGrid; namespace Lskj.Control { /// /// 自动搜索框弹出框 /// public partial class AutoTreePopup : UserControl { /// /// 是否显示添加按钮 /// /// true if [add visible]; otherwise, false. public bool AddVisible { get { return this.btnAdd.Visible; } set { this.btnAdd.Visible = this.pl_bottom.Visible = value; } } /// /// 输入框 /// public AutoTreeLookUp LookUp; /// /// Gets the TreeView object. /// /// The TreeView object. public TreeView TreeViewObj { get { return this.tvMain.TreeView; } } /// /// Gets the TreeView ex object. /// /// The TreeView ex object. public TreeViewEx TreeViewExObj { get { return this.tvMain; } } /// /// 弹出框回车事件 /// public event KeyEventHandler OnGridViewEnter; /// /// 添加按钮点击事件 /// public event EventHandler OnAddMouseClick; /// /// 弹出框鼠标点击 /// public event EventHandler OnGridViewMouseClick; /// /// 弹出框是否显示 /// /// true if this instance is show popup; otherwise, false. public bool IsShowPopup; /// /// The value field /// public string ValueField = string.Empty; /// /// The value member /// [Description("设置ValueMember")] public string ValueMember = string.Empty; /// /// The text field /// [Description("设置TextMember")] public string TextMember = string.Empty; public AutoTreePopup() { InitializeComponent(); } /// /// 设置数据源 /// /// The data source. public object DataSource { get { return this!= null ? this.TreeViewExObj.DataSource : null; } set { if (value != null) { this.TreeViewExObj.BindTreeView(value as DataTable); } } } /// /// 说明:键盘弹起 /// 创建人:龚宇超 /// 创建日期:2018-03-16 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnGridViewKeyUp(object sender, KeyEventArgs e) { if (this.OnGridViewEnter != null) this.OnGridViewEnter(this.TreeViewObj, e); } /// /// 说明:点击GridView /// 创建人:龚宇超 /// 创建日期:2018-03-16 /// 修改人: /// 修改日期: /// 修改备注: /// /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnGridViewMouseDown(object sender, MouseEventArgs e) { //int rowHandle = this.gridView.CalcHitInfo(e.X, e.Y).RowHandle; //this.gridView.FocusedRowHandle = rowHandle; //this.gridView.SelectRow(rowHandle); //if (rowHandle > -1 && this.OnGridViewMouseClick != null) // this.OnGridViewMouseClick(this.gridView, null); } /// /// 说明:添加操作 /// 创建人:龚宇超 /// 创建日期:2018-04-03 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. protected void OnAddButtonClick(object sender, EventArgs e) { if (this.OnAddMouseClick != null) this.OnAddMouseClick(sender, e); } } }