/// <summary> /// Layouts all child controls when a IFluidContainer has changed it's size depending on the child's anchor style. /// </summary> /// <param name="container"></param> /// <param name="oldContainerSize"></param> /// <param name="newContainerSize"></param> /// <param name="scaleFactor"></param> public static void Layout(IMultiControlContainer container, Size oldContainerSize, Size newContainerSize, SizeF scaleFactor) { Rectangle Bounds = container.Bounds; Size oldSize = Bounds.Size; if (newContainerSize != oldContainerSize) { foreach (FluidControl c in container.Controls) { Adjust(c, oldContainerSize, newContainerSize, container.ScaleFactor); } } }
/// <summary> /// Stops all nested animations of this control. /// </summary> public virtual void StopNestedAnimations() { StopAnimations(); IMultiControlContainer mc = this as IMultiControlContainer; if (mc != null) { foreach (FluidControl c in mc.Controls) { c.StopNestedAnimations(); } } }
/// <summary> /// Layouts all child controls when a IFluidContainer has changed it's size depending on the child's anchor style. /// </summary> /// <param name="container"></param> /// <param name="oldContainerSize"></param> /// <param name="newContainerSize"></param> /// <param name="scaleFactor"></param> public static void Layout(IMultiControlContainer container, Size oldContainerSize, Size newContainerSize, SizeF scaleFactor) { Rectangle Bounds = container.Bounds; Size oldSize = Bounds.Size; if (newContainerSize != oldContainerSize) { foreach (FluidControl c in container.Controls) { Adjust(c, oldContainerSize, newContainerSize, container.ScaleFactor); } } }
/// <summary> /// Scales the control with the specified factor. /// </summary> /// <param name="scaleFactor"></param> public virtual void Scale(SizeF scaleFactor) { if (scaleFactor != this.scaleFactor) { this.scaleFactor = scaleFactor; BeginInit(); try { Rectangle r = Bounds; // do not use Bounds so no OnSizeChanged is raised! this.bounds = new Rectangle( (int)(r.X * scaleFactor.Width), (int)(r.Y * scaleFactor.Height), (int)(r.Width * scaleFactor.Width), (int)(r.Height * scaleFactor.Height)); { IMultiControlContainer container = this as IMultiControlContainer; if (container != null && container.Controls != null) { foreach (FluidControl c in container.Controls) { c.Scale(scaleFactor); } } } { ISingleControlContainer container = this as ISingleControlContainer; if (container != null && container.Control != null) { container.Control.Scale(scaleFactor); } } } finally { EndInit(); Invalidate(); } } }