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 Lskj.Control.Model; using Lskj.Business.Impl; namespace Lskj.Control { public partial class PubTableLTookUp : 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 GridColumnModel model; /// /// 输入框 /// public AutoTreeLookUp LookUp; /// ///表格 /// public GridControlEx GridControlExObj { get { return this.gcMain; } } /// /// 弹出框回车事件 /// 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 string SourceSQL = string.Empty; /// /// 不是根节点是否能被选中 /// public bool isRootNode = true; public PubTableLTookUp() { InitializeComponent(); } /// /// 设置数据源 /// /// The data source. public object DataSource { get { return this!= null ? this.GridControlExObj.gridControl.DataSource : null; } set { if (value != null) { this.GridControlExObj.gridControl.DataSource = (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) { try { if (this.OnGridViewEnter != null) this.OnGridViewEnter(this.GridControlExObj, e); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message,ex.Message); } } /// /// 说明:点击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) { try { if (this.OnAddMouseClick != null) this.OnAddMouseClick(sender, e); } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message,ex.Message); } } /// /// 说明:设置数据源 /// 创建人:王一帆 /// 创建日期:2021-03-24 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The data source. public void SetDataSource(DataTable dataSource) { this.DataSource = dataSource; } } }