feat: 优化初始化缓存及控件功能
This commit is contained in:
@@ -24,8 +24,9 @@ namespace Lskj.Control.Model
|
||||
/// <summary>
|
||||
/// 表格拖拽到树结构
|
||||
/// </summary>
|
||||
public class GridDragTree
|
||||
public class GridDragTree : IDisposable
|
||||
{
|
||||
private bool _disposed;
|
||||
/// <summary>
|
||||
/// 拖动位置
|
||||
/// </summary>
|
||||
@@ -59,6 +60,46 @@ namespace Lskj.Control.Model
|
||||
this._treeView.AllowDrop = true;
|
||||
this._treeView.DragOver += new DragEventHandler(treeView_DragOver);
|
||||
this._treeView.DragDrop += new DragEventHandler(treeView_DragDrop);
|
||||
if (this._gridView.GridControl != null)
|
||||
{
|
||||
this._gridView.GridControl.Disposed += OnOwnerDisposed;
|
||||
}
|
||||
this._treeView.Disposed += OnOwnerDisposed;
|
||||
}
|
||||
|
||||
private void OnOwnerDisposed(object sender, EventArgs e)
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模块关闭时解除源表格和目标树的拖拽事件。
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
|
||||
if (_gridView != null)
|
||||
{
|
||||
_gridView.MouseDown -= gridView_MouseDown;
|
||||
_gridView.MouseMove -= gridView_MouseMove;
|
||||
if (_gridView.GridControl != null)
|
||||
{
|
||||
_gridView.GridControl.Disposed -= OnOwnerDisposed;
|
||||
}
|
||||
}
|
||||
if (_treeView != null)
|
||||
{
|
||||
_treeView.DragOver -= treeView_DragOver;
|
||||
_treeView.DragDrop -= treeView_DragDrop;
|
||||
_treeView.Disposed -= OnOwnerDisposed;
|
||||
}
|
||||
|
||||
OnDragComplete = null;
|
||||
_hitInfo = null;
|
||||
_gridView = null;
|
||||
_treeView = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user