Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3391 for trunk/sources


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

added drag and drop in ViewHost (ticket #972)

Location:
trunk/sources/HeuristicLab.MainForm.WindowsForms/3.2
Files:
2 edited

Legend:

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

    r3281 r3391  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.components = new System.ComponentModel.Container();
     47      this.components = new System.ComponentModel.Container();
     48      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ViewHost));
    4849      this.viewPanel = new System.Windows.Forms.Panel();
    4950      this.messageLabel = new System.Windows.Forms.Label();
    5051      this.viewsLabel = new System.Windows.Forms.Label();
     52      this.viewContextMenuStrip = new HeuristicLab.MainForm.WindowsForms.ViewContextMenuStrip();
    5153      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    52       this.viewContextMenuStrip = new HeuristicLab.MainForm.WindowsForms.ViewContextMenuStrip(this.components);
    5354      this.SuspendLayout();
    5455      //
     
    8283      this.viewsLabel.Size = new System.Drawing.Size(16, 16);
    8384      this.viewsLabel.TabIndex = 0;
    84       this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view." + System.Environment.NewLine + "Right-click to change current view.");
     85      this.toolTip.SetToolTip(this.viewsLabel, "Double-click to open a new window of the current view.\r\nRight-click to change cur" +
     86              "rent view.");
     87      this.viewsLabel.MouseLeave += new System.EventHandler(this.viewsLabel_MouseLeave);
    8588      this.viewsLabel.DoubleClick += new System.EventHandler(this.viewsLabel_DoubleClick);
     89      this.viewsLabel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.viewsLabel_MouseDown);
    8690      //
    8791      // viewContextMenuStrip
    8892      //
     93      this.viewContextMenuStrip.IgnoredViewTypes = ((System.Collections.Generic.IEnumerable<System.Type>)(resources.GetObject("viewContextMenuStrip.IgnoredViewTypes")));
    8994      this.viewContextMenuStrip.Item = null;
    9095      this.viewContextMenuStrip.Name = "viewContextMenuStrip";
  • 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.