public void ContainerResized(ResizeEventArgs e) { if ((_anchor & (ControlAnchor.Left | ControlAnchor.Right)) == 0) { X = X * e.NewSize.Width / e.OldSize.Width; } else { //Nothing needs to be done if the left ancher is set //if ((_anchor & ControlAnchor.Left) != 0) //{ // //} if ((_anchor & ControlAnchor.Right) != 0) { Right += e.NewSize.Width - e.OldSize.Width; } } if ((_anchor & (ControlAnchor.Top | ControlAnchor.Bottom)) == 0) { Y = Y * e.NewSize.Height / e.OldSize.Height; } else { //Nothing needs to be done if the top ancher is set if ((_anchor & ControlAnchor.Bottom) != 0) { Bottom += e.NewSize.Height - e.OldSize.Height; } } }
public override void DoResize(ResizeEventArgs e) { base.DoResize(e); foreach (Control Item in _Items.Values.Reverse()) { Item.ContainerResized(e); } }
public virtual void DoResize(ResizeEventArgs e) { Resized?.Invoke(this, e); }