Ignore:
Timestamp:
04/18/10 02:31:51 (12 years ago)
Author:
mkommend
Message:

added drag and drop in ViewHost (ticket #972)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2/ViewHost.cs

    r3389 r3391  
    3535      viewType = null;
    3636      Content = null;
     37      startDragAndDrop = false;
    3738      viewContextMenuStrip.IgnoredViewTypes = new List<Type>() { typeof(ViewHost) };
    3839    }
     
    164165      ViewType = viewType;
    165166    }
     167
     168    private bool startDragAndDrop;
     169    private void viewsLabel_MouseDown(object sender, MouseEventArgs e) {
     170      startDragAndDrop = true;
     171      viewsLabel.Capture = false;
     172    }
     173
     174    private void viewsLabel_MouseLeave(object sender, EventArgs e) {
     175      if ((Control.MouseButtons & MouseButtons.Left) == MouseButtons.Left && startDragAndDrop) {
     176        DataObject data = new DataObject();
     177        data.SetData("Type", Content.GetType());
     178        data.SetData("Value", Content);
     179        DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     180      } else
     181        startDragAndDrop = false;
     182    }
    166183  }
    167184}
Note: See TracChangeset for help on using the changeset viewer.