ab56a9bcf7
SVN-Revision: r240
169 lines
5.4 KiB
C#
169 lines
5.4 KiB
C#
/******************************
|
|
* 说明:自动搜索框弹出框
|
|
* 创建人:龚宇超
|
|
* 创建日期: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
|
|
{
|
|
/// <summary>
|
|
/// 自动搜索框弹出框
|
|
/// </summary>
|
|
public partial class AutoTreePopup : 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 AutoTreeLookUp LookUp;
|
|
/// <summary>
|
|
/// Gets the TreeView object.
|
|
/// </summary>
|
|
/// <value>The TreeView object.</value>
|
|
public TreeView TreeViewObj { get { return this.tvMain.TreeView; } }
|
|
/// <summary>
|
|
/// Gets the TreeView ex object.
|
|
/// </summary>
|
|
/// <value>The TreeView ex object.</value>
|
|
public TreeViewEx TreeViewExObj { get { return this.tvMain; } }
|
|
/// <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;
|
|
|
|
public AutoTreePopup()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
/// <summary>
|
|
/// 设置数据源
|
|
/// </summary>
|
|
/// <value>The data source.</value>
|
|
public object DataSource
|
|
{
|
|
get
|
|
{
|
|
return this!= null ? this.TreeViewExObj.DataSource : null;
|
|
}
|
|
set
|
|
{
|
|
if (value != null)
|
|
{
|
|
|
|
this.TreeViewExObj.BindTreeView(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)
|
|
{
|
|
if (this.OnGridViewEnter != null)
|
|
this.OnGridViewEnter(this.TreeViewObj, e);
|
|
}
|
|
/// <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)
|
|
{
|
|
if (this.OnAddMouseClick != null)
|
|
this.OnAddMouseClick(sender, e);
|
|
}
|
|
|
|
|
|
}
|
|
}
|