ab56a9bcf7
SVN-Revision: r240
119 lines
3.7 KiB
C#
119 lines
3.7 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.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.Control.SiftColControl
|
|
{
|
|
public partial class DragItem : UserControl
|
|
{
|
|
public DragItem(DragItemModel _dragItemModel = null)
|
|
{
|
|
this.dragItemModel = _dragItemModel;
|
|
InitializeComponent();
|
|
}
|
|
#region 变量
|
|
///// <summary>
|
|
///// 计算操作字段
|
|
///// </summary>
|
|
//public string ValString = string.Empty;
|
|
///// <summary>
|
|
///// 数据源列名
|
|
///// </summary>
|
|
//public string FieldColName = string.Empty;
|
|
public DragItemModel dragItemModel;
|
|
private btn_ClickEventHanlder _btnClickEvent = null;
|
|
/// <summary>
|
|
/// 关闭按钮点击
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void btn_ClickEventHanlder(Lskj.Control.SiftColControl.DragItem sender);
|
|
private MouseDownEventHanlder _mouseDownEvent = null;
|
|
/// <summary>
|
|
/// 鼠标按下开始拖拽
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void MouseDownEventHanlder(Lskj.Control.SiftColControl.DragItem sender);
|
|
private MouseUpEventHanlder _mouseUpEvent = null;
|
|
/// <summary>
|
|
/// 鼠标右击打开菜单
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void MouseUpEventHanlder(Lskj.Control.SiftColControl.DragItem sender, MouseEventArgs e);
|
|
#endregion
|
|
#region 事件
|
|
#region 控件加载时
|
|
private void OnDragItem_Load(object sender, EventArgs e)
|
|
{
|
|
this.ItemBtn.Click += OnItemBtn_Click;
|
|
this.MouseDown += OnDragItem_MouseDown;
|
|
this.ItemLable.MouseDown += OnItemLable_MouseDown;
|
|
this.MouseUp += OnDragItem_MouseUp;
|
|
this.ItemLable.MouseUp += OnDragItem_MouseUp;
|
|
}
|
|
|
|
#endregion
|
|
#region 鼠标按下时开始拖拽
|
|
private void OnDragItem_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
if (_mouseDownEvent != null)
|
|
{
|
|
_mouseDownEvent(this);
|
|
}
|
|
}
|
|
private void OnItemLable_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
if (_mouseDownEvent != null)
|
|
{
|
|
_mouseDownEvent(this);
|
|
}
|
|
}
|
|
#endregion
|
|
#region 关闭按钮点击事件
|
|
private void OnItemBtn_Click(object sender, EventArgs e)
|
|
{
|
|
if (_btnClickEvent != null)
|
|
{
|
|
_btnClickEvent(this);
|
|
}
|
|
}
|
|
#endregion
|
|
#region 鼠标右击打开菜单
|
|
void OnDragItem_MouseUp(object sender, MouseEventArgs e)
|
|
{
|
|
if (_mouseUpEvent != null)
|
|
{
|
|
_mouseUpEvent(this, e);
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
#region 方法
|
|
#region 获得关闭按钮点击
|
|
public void setClickEvent(btn_ClickEventHanlder btnClickEvent)
|
|
{
|
|
this._btnClickEvent = btnClickEvent;
|
|
}
|
|
#endregion
|
|
#region 获得鼠标按下
|
|
public void setMouseDownEvent(MouseDownEventHanlder mouseDownEvent)
|
|
{
|
|
this._mouseDownEvent = mouseDownEvent;
|
|
}
|
|
#endregion
|
|
#region 获得右击菜单
|
|
public void setMouseUpEvent(MouseUpEventHanlder mouseUpEvent)
|
|
{
|
|
this._mouseUpEvent = mouseUpEvent;
|
|
}
|
|
#endregion
|
|
#endregion
|
|
|
|
}
|
|
}
|