/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnKeyUp(KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { if (this._selectedNode != null) { this.SelectedNode = this._selectedNode; } if (this._previousNode != null) { this._previousNode.BackColor = SystemColors.HighlightText; this._previousNode.ForeColor = SystemColors.ControlText; } this.Cursor = Cursors.Default; this._formDrag.Visible = false; // Call cancel event if (this.DragCancel != null) { DragItemEventArgs ea = new DragItemEventArgs(); ea.Node = this._selectedNode; this.DragCancel(this, ea); } } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnDragLeave(EventArgs e) { if (this._selectedNode != null) { this.SelectedNode = this._selectedNode; } if (this._previousNode != null) { this._previousNode.BackColor = this._dragOverNodeBackColor; this._previousNode.ForeColor = this._dragOverNodeForeColor; } this._formDrag.Visible = false; this.Cursor = Cursors.Default; // Call cancel event if (this.DragCancel != null) { DragItemEventArgs ea = new DragItemEventArgs(); ea.Node = this._selectedNode; this.DragCancel(this, ea); } }
private void tvBots_DragStart(object sender, DragItemEventArgs e) { if (e.Node.Tag == null) { tvNewBots.AllowDrop = false; } else { tvNewBots.AllowDrop = true; } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnItemDrag(System.Windows.Forms.ItemDragEventArgs e) { this._selectedNode = (TreeNode)e.Item; // Call dragstart event if (this.DragStart != null) { DragItemEventArgs ea = new DragItemEventArgs(); ea.Node = this._selectedNode; this.DragStart(this, ea); } // Change any previous node back if (this._previousNode != null) { this._previousNode.BackColor = SystemColors.HighlightText; this._previousNode.ForeColor = SystemColors.ControlText; } // Move the form with the icon/label on it // A better width measurement algo for the form is needed here int width = Width = this._selectedNode.Text.Length * (int)this._formDrag.labelText.Font.Size; if (this._selectedNode.Text.Length < 5) { width += 20; } this._formDrag.Size = new Size(width, this._formDrag.Height); this._formDrag.labelText.Size = new Size(width, this._formDrag.labelText.Size.Height); this._formDrag.labelText.Text = this._selectedNode.Text; // Start drag drop this.DoDragDrop(e.Item, this._dragMode); }
private void tvNewBots_DragStart(object sender, DragItemEventArgs e) { tvNewBots.AllowDrop = false; tvBots.AllowDrop = false; }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnKeyUp(KeyEventArgs e) { if ( e.KeyCode == Keys.Escape ) { if ( this._selectedNode != null ) { this.SelectedNode = this._selectedNode; } if ( this._previousNode != null ) { this._previousNode.BackColor = SystemColors.HighlightText; this._previousNode.ForeColor = SystemColors.ControlText; } this.Cursor = Cursors.Default; this._formDrag.Visible = false; // Call cancel event if ( this.DragCancel != null ) { DragItemEventArgs ea = new DragItemEventArgs(); ea.Node = this._selectedNode; this.DragCancel(this,ea); } } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnItemDrag(System.Windows.Forms.ItemDragEventArgs e) { this._selectedNode = (TreeNode) e.Item; // Call dragstart event if ( this.DragStart != null ) { DragItemEventArgs ea = new DragItemEventArgs(); ea.Node = this._selectedNode; this.DragStart(this,ea); } // Change any previous node back if ( this._previousNode != null ) { this._previousNode.BackColor = SystemColors.HighlightText; this._previousNode.ForeColor = SystemColors.ControlText; } // Move the form with the icon/label on it // A better width measurement algo for the form is needed here int width = Width = this._selectedNode.Text.Length * (int) this._formDrag.labelText.Font.Size; if ( this._selectedNode.Text.Length < 5 ) width += 20; this._formDrag.Size = new Size(width,this._formDrag.Height); this._formDrag.labelText.Size = new Size(width,this._formDrag.labelText.Size.Height); this._formDrag.labelText.Text = this._selectedNode.Text; // Start drag drop this.DoDragDrop(e.Item,this._dragMode); }
/// <summary> /// /// </summary> /// <param name="e"></param> protected override void OnDragLeave(EventArgs e) { if ( this._selectedNode != null ) { this.SelectedNode = this._selectedNode; } if ( this._previousNode != null ) { this._previousNode.BackColor = this._dragOverNodeBackColor; this._previousNode.ForeColor = this._dragOverNodeForeColor; } this._formDrag.Visible = false; this.Cursor = Cursors.Default; // Call cancel event if ( this.DragCancel != null ) { DragItemEventArgs ea = new DragItemEventArgs(); ea.Node = this._selectedNode; this.DragCancel(this,ea); } }