/// <summary> /// Sends the entity down the z-order stack with the specified amount. /// </summary> /// <param name="entity">The entity.</param> /// <param name="zShift">The z shift.</param> public void SendBackwards(IDiagramEntity entity, int zShift) { if (mPaintables.Contains(entity)) { int newpos = mPaintables.IndexOf(entity) - zShift; //if this is the first in the row you cannot move it lower if (newpos >= 0) { mPaintables.Remove(entity); mPaintables.Insert(newpos, entity); ReAssignSceneIndex(); Rectangle rec = entity.Rectangle; rec.Inflate(20, 20); this.RaiseOnInvalidateRectangle(Rectangle); } } }