public void Attach(BoardEditorPanel panel)
        {
            this.panel        = panel;
            this.panel.Cursor = Cursors.Default;

            this.placingComponent          = this.componentBuilder();
            this.placingComponent.Position = GetGatePosition();
        }
 public void OnKeyDown(KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         var component = this.panel.Board.SelectedComponent;
         if (component != null)
         {
             component.ClearAccess();
             this.tracingComponent = null;
             this.panel.Board.RemoveComponent(component);
             this.panel.Refresh();
         }
     }
 }
        public void OnMouseDown(MouseEventArgs e)
        {
            bool alert = this.panel.Board.IsConflict(this.placingComponent.Bounds);

            if (!alert)
            {
                this.panel.Board.AddComponent(this.placingComponent);
                this.placingComponent = null;
                this.panel.Refresh();

                this.placingComponent          = this.componentBuilder();
                this.placingComponent.Position = GetGatePosition();
            }
        }
 public void OnMouseDown(MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         this.panel.Board.SelectedComponent = this.tracingComponent;
         if (this.tracingComponent != null)
         {
             this.panel.Cursor     = Cursors.SizeAll;
             this.tracingComponent = null;
             this.dragging         = true;
             this.draggingOffset   = this.panel.Board.SelectedComponent.Position - new Size(this.location);
         }
         this.panel.Refresh();
     }
 }
            public void OnMouseMove(MouseEventArgs e)
            {
                this.location = e.Location;
                if (this.dragging)
                {
                    Point p = this.location + new Size(this.draggingOffset);
                    Point d = p - new Size(this.panel.Board.SelectedComponent.Position);
                    d.X = d.X % BoardEditorPanel.GridSize;
                    d.Y = d.Y % BoardEditorPanel.GridSize;
                    p  -= new Size(d);

                    this.panel.Board.SelectedComponent.Position = p;
                    this.panel.Refresh();
                }
                else
                {
                    var component = GetComponent();
                    if (this.tracingComponent != component)
                    {
                        this.tracingComponent = GetComponent();
                        this.panel.Refresh();
                    }
                }
            }