public void ChildSize(EDockSite location, double value, EDockResizeMode resize_mode) { if (value < 0 || double.IsNaN(value)) { throw new Exception($"Invalid child size ({value}) for {location}"); } if (RenderSize.Width == 0 || RenderSize.Height == 0) { throw new Exception($"Invalid size for this branch, can't determine dock size for {location}"); } DockSizes.SetSize(location, DisplayRectangle, value, resize_mode); }
private Rect CalculateDockSizeAndPositionInPx(DockEdges position, DockSizes size) { Log.InfoFormat("CalculateDockSizeAndPositionInPx called with position:{0}, size:{1}", position, size); double x, y, width, height; var thicknessAsPercentage = size == DockSizes.Full ? getFullDockThicknessAsPercentageOfScreen() / 100 : (getFullDockThicknessAsPercentageOfScreen() * getCollapsedDockThicknessAsPercentageOfFullDockThickness()) / 10000; //Percentage of a percentage switch (position) { case DockEdges.Top: x = screenBoundsInPx.X; y = screenBoundsInPx.Y; width = screenBoundsInPx.Width; height = screenBoundsInPx.Height * thicknessAsPercentage; break; case DockEdges.Bottom: x = screenBoundsInPx.X; y = screenBoundsInPx.Y + screenBoundsInPx.Height - (screenBoundsInPx.Height * thicknessAsPercentage); width = screenBoundsInPx.Width; height = screenBoundsInPx.Height * thicknessAsPercentage; break; case DockEdges.Left: x = screenBoundsInPx.X; y = screenBoundsInPx.Y; width = screenBoundsInPx.Width * thicknessAsPercentage; height = screenBoundsInPx.Height; break; default: //case DockEdges.Right: x = screenBoundsInPx.X + screenBoundsInPx.Width - (screenBoundsInPx.Width * thicknessAsPercentage); y = screenBoundsInPx.Y; width = screenBoundsInPx.Width * thicknessAsPercentage; height = screenBoundsInPx.Height; break; } return new Rect(x, y, width, height); }
/// <summary>Get/Set the size for a dock site in this branch (in pixels)</summary> public double ChildSize(EDockSite location) { return(DockSizes.GetSize(location, DisplayRectangle, DockedMask)); }