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); } } } }
internal void SilentRemove(GraphPanelElement item, bool inter) { base.Remove(item); if (this.ItemsChanged != null) { this.ItemsChanged(this, new System.EventArgs()); } }
/// <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()); } }
public void Clear() { while (li.Count > 0) { GraphPanelElement l = li[0]; li.RemoveAt(0); l.Clear(); l.Parent = null; } this.Refresh(); }
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); } }
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); }
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; } } } }
/// <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); }
/// <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)); }
/// <summary> /// remove an Element /// </summary> /// <param name="item">The object that should be removed</param> public void Remove(GraphPanelElement item) { this.SilentRemove(item, false); }
/// <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)); }