feat: 优化初始化缓存及控件功能

This commit is contained in:
cyf
2026-08-14 20:33:43 +08:00
parent 222ae3c08a
commit f665688d0b
27 changed files with 505 additions and 106 deletions
+42 -1
View File
@@ -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;
}