ab56a9bcf7
SVN-Revision: r240
191 lines
6.2 KiB
C#
191 lines
6.2 KiB
C#
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
|
|
{ /// <summary>
|
|
/// 是否显示添加按钮
|
|
/// </summary>
|
|
/// <value><c>true</c> if [add visible]; otherwise, <c>false</c>.</value>
|
|
public bool AddVisible
|
|
{
|
|
get { return this.btnAdd.Visible; }
|
|
set
|
|
{
|
|
this.btnAdd.Visible = this.pl_bottom.Visible = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 列配置模块
|
|
/// </summary>
|
|
public GridColumnModel model;
|
|
|
|
/// <summary>
|
|
/// 输入框
|
|
/// </summary>
|
|
public AutoTreeLookUp LookUp;
|
|
|
|
/// <summary>
|
|
///表格
|
|
/// </summary>
|
|
public GridControlEx GridControlExObj { get { return this.gcMain; } }
|
|
/// <summary>
|
|
/// 弹出框回车事件
|
|
/// </summary>
|
|
public event KeyEventHandler OnGridViewEnter;
|
|
/// <summary>
|
|
/// 添加按钮点击事件
|
|
/// </summary>
|
|
public event EventHandler OnAddMouseClick;
|
|
/// <summary>
|
|
/// 弹出框鼠标点击
|
|
/// </summary>
|
|
public event EventHandler OnGridViewMouseClick;
|
|
/// <summary>
|
|
/// 弹出框是否显示
|
|
/// </summary>
|
|
/// <value><c>true</c> if this instance is show popup; otherwise, <c>false</c>.</value>
|
|
public bool IsShowPopup;
|
|
/// <summary>
|
|
/// The value field
|
|
/// </summary>
|
|
public string ValueField = string.Empty;
|
|
/// <summary>
|
|
/// The value member
|
|
/// </summary>
|
|
[Description("设置ValueMember")]
|
|
public string ValueMember = string.Empty;
|
|
/// <summary>
|
|
/// The text field
|
|
/// </summary>
|
|
[Description("设置TextMember")]
|
|
public string TextMember = string.Empty;
|
|
/// <summary>
|
|
/// 数据源
|
|
/// </summary>
|
|
public string SourceSQL = string.Empty;
|
|
/// <summary>
|
|
/// 不是根节点是否能被选中
|
|
/// </summary>
|
|
public bool isRootNode = true;
|
|
|
|
public PubTableLTookUp()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
/// <summary>
|
|
/// 设置数据源
|
|
/// </summary>
|
|
/// <value>The data source.</value>
|
|
public object DataSource
|
|
{
|
|
get
|
|
{
|
|
return this!= null ? this.GridControlExObj.gridControl.DataSource : null;
|
|
}
|
|
set
|
|
{
|
|
if (value != null)
|
|
{
|
|
|
|
this.GridControlExObj.gridControl.DataSource = (value as DataTable);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:键盘弹起</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-16 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param>
|
|
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);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:点击GridView</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-03-16 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
|
|
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);
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:添加操作</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
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);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置数据源</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2021-03-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="dataSource">The data source.</param>
|
|
public void SetDataSource(DataTable dataSource)
|
|
{
|
|
this.DataSource = dataSource;
|
|
}
|
|
}
|
|
}
|