Drag and drop feature for Project Explorer

This commit is contained in:
ZerX 2022-08-19 13:13:29 +02:00
parent ba16eab570
commit 7917453b19
2 changed files with 17 additions and 0 deletions

View File

@ -34,6 +34,7 @@
// //
// ProjectTreeView // ProjectTreeView
// //
this.ProjectTreeView.AllowDrop = true;
this.ProjectTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None; this.ProjectTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.ProjectTreeView.Dock = System.Windows.Forms.DockStyle.Fill; this.ProjectTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
this.ProjectTreeView.FullRowSelect = true; this.ProjectTreeView.FullRowSelect = true;
@ -47,6 +48,8 @@
this.ProjectTreeView.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.ProjectTreeView_BeforeCollapse); this.ProjectTreeView.BeforeCollapse += new System.Windows.Forms.TreeViewCancelEventHandler(this.ProjectTreeView_BeforeCollapse);
this.ProjectTreeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.ProjectTreeView_BeforeExpand); this.ProjectTreeView.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.ProjectTreeView_BeforeExpand);
this.ProjectTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ProjectTreeView_AfterSelect); this.ProjectTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.ProjectTreeView_AfterSelect);
this.ProjectTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.ProjectTreeView_DragDrop);
this.ProjectTreeView.DragEnter += new System.Windows.Forms.DragEventHandler(this.ProjectTreeView_DragEnter);
this.ProjectTreeView.DoubleClick += new System.EventHandler(this.ProjectTreeView_DoubleClick); this.ProjectTreeView.DoubleClick += new System.EventHandler(this.ProjectTreeView_DoubleClick);
this.ProjectTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ProjectTreeView_MouseDown); this.ProjectTreeView.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ProjectTreeView_MouseDown);
// //

View File

@ -2708,6 +2708,20 @@ namespace CodeWalker.Project.Panels
{ {
inDoubleClick = (e.Clicks > 1); //disabling doubleclick expand/collapse inDoubleClick = (e.Clicks > 1); //disabling doubleclick expand/collapse
} }
private void ProjectTreeView_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetData(DataFormats.FileDrop) != null) //disabling drag and drop text
e.Effect = DragDropEffects.All;
}
private void ProjectTreeView_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[]) e.Data.GetData(DataFormats.FileDrop);
ProjectForm.OpenFiles(files);
}
} }
public delegate void ProjectExplorerItemSelectHandler(object item); public delegate void ProjectExplorerItemSelectHandler(object item);
public delegate void ProjectExplorerItemActivateHandler(object item); public delegate void ProjectExplorerItemActivateHandler(object item);