예제 #1
0
        /// <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);
                }
            }
        }
예제 #2
0
        /// <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);
            }
        }
예제 #3
0
 private void tvBots_DragStart(object sender, DragItemEventArgs e)
 {
     if (e.Node.Tag == null)
     {
         tvNewBots.AllowDrop = false;
     }
     else
     {
         tvNewBots.AllowDrop = true;
     }
 }
예제 #4
0
        /// <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);
        }
예제 #5
0
 private void tvNewBots_DragStart(object sender, DragItemEventArgs e)
 {
     tvNewBots.AllowDrop = false;
     tvBots.AllowDrop = false;
 }
예제 #6
0
 private void tvBots_DragStart(object sender, DragItemEventArgs e)
 {
     if (e.Node.Tag == null)
     {
         tvNewBots.AllowDrop = false;
     }
     else
     {
         tvNewBots.AllowDrop = true;
     }
 }
예제 #7
0
 private void tvNewBots_DragStart(object sender, DragItemEventArgs e)
 {
     tvNewBots.AllowDrop = false;
     tvBots.AllowDrop    = false;
 }
예제 #8
0
        /// <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);
                }
            }
        }
예제 #9
0
        /// <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);
        }
예제 #10
0
        /// <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);
            }
        }