Beispiel #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            bool hit = false;

            GraphPanelElement[] elements = new GraphPanelElement[li.Count];
            li.CopyTo(elements);
            for (int i = elements.Length - 1; i >= 0; i--)
            {
                GraphPanelElement c = elements[i];

                if (c is DragPanel)
                {
                    if (!hit)
                    {
                        if (((DragPanel)c).OnMouseDown(e))
                        {
                            if (e.Button == System.Windows.Forms.MouseButtons.Left)
                            {
                                hit = true;
                                ((DragPanel)c).SetFocus(true);
                                continue;
                            }
                        }
                    }

                    if (e.Button == System.Windows.Forms.MouseButtons.Left)
                    {
                        ((DragPanel)c).SetFocus(false);
                    }
                }
            }
        }
Beispiel #2
0
 internal void SilentRemove(GraphPanelElement item, bool inter)
 {
     base.Remove(item);
     if (this.ItemsChanged != null)
     {
         this.ItemsChanged(this, new System.EventArgs());
     }
 }
Beispiel #3
0
 /// <summary>
 /// insert a new Element
 /// </summary>
 /// <param name="index">The Index where the Element should be stored</param>
 /// <param name="item">The object that should be inserted</param>
 public void Insert(int index, GraphPanelElement item)
 {
     if (this.Contains(item))
     {
         return;
     }
     base.Insert(index, item);
     if (this.ItemsChanged != null)
     {
         this.ItemsChanged(this, new System.EventArgs());
     }
 }
Beispiel #4
0
        public void Clear()
        {
            while (li.Count > 0)
            {
                GraphPanelElement l = li[0];
                li.RemoveAt(0);
                l.Clear();
                l.Parent = null;
            }

            this.Refresh();
        }
Beispiel #5
0
 protected override void OnPaint(PaintEventArgs e)
 {
     if (update)
     {
         return;
     }
     base.OnPaint(e);
     GraphPanelElement.SetGraphicsMode(e.Graphics, true);
     foreach (GraphPanelElement c in li)
     {
         c.OnPaint(e);
     }
 }
Beispiel #6
0
        internal int SilentAdd(GraphPanelElement item, bool inter)
        {
            if (this.Contains(item))
            {
                return(-1);
            }
            int res = base.Add(item);

            if (this.ItemsChanged != null)
            {
                this.ItemsChanged(this, new System.EventArgs());
            }
            return(res);
        }
Beispiel #7
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            base.OnMouseUp(e);
            for (int i = li.Count - 1; i >= 0; i--)
            {
                GraphPanelElement c = li[i];

                if (c is DragPanel)
                {
                    if (((DragPanel)c).OnMouseUp(e))
                    {
                        break;
                    }
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// Die verwendeten Ressourcen bereinigen.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }

                if (li != null)
                {
                    while (li.Count > 0)
                    {
                        GraphPanelElement l = li[0];
                        li.RemoveAt(0);
                        l.Dispose();
                    }
                }
            }
            base.Dispose(disposing);
        }
Beispiel #9
0
 /// <summary>
 /// Checks wether or not the object is already stored in the List
 /// </summary>
 /// <param name="item">The Object you are looking for</param>
 /// <returns>true, if it was found</returns>
 public bool Contains(GraphPanelElement item)
 {
     return(base.Contains(item));
 }
Beispiel #10
0
 /// <summary>
 /// remove an Element
 /// </summary>
 /// <param name="item">The object that should be removed</param>
 public void Remove(GraphPanelElement item)
 {
     this.SilentRemove(item, false);
 }
Beispiel #11
0
 /// <summary>
 /// add a new Element
 /// </summary>
 /// <param name="item">The object you want to add</param>
 /// <returns>The index it was added on</returns>
 public int Add(GraphPanelElement item)
 {
     return(SilentAdd(item, false));
 }