public static void BatchDraw(Control control, GraphicsDevice device, SpriteBatch spriteBatch, Vector2 offset, GameTime gameTime) { if (control != null && control.Visible) { spriteBatch.Begin(); control.Draw(new DrawContext { Device = device, SpriteBatch = spriteBatch, DrawOffset = offset + control.Position, GameTime = gameTime }); spriteBatch.End(); } }
protected virtual void OnChildRemoved(int index, Control child) { this.InvalidateAutoSize(); }
public void AddChild(Control child, int index) { if (child.Parent != null) { child.Parent.RemoveChild(child); } child.Parent = this; if (this.children == null) { this.children = new List<Control>(); } this.children.Insert(index, child); this.OnChildAdded(index, child); }
public void RemoveChild(Control child) { if (child.Parent != this) { throw new InvalidOperationException(); } this.RemoveChildAt(this.children.IndexOf(child)); }
public void AddChild(Control child) { if (child.Parent != null) { child.Parent.RemoveChild(child); } this.AddChild(child, this.ChildCount); }