private static void UpdateSelectedBrush(IBrush brush) { CurrentControls.ForEach(x => x.ValuesChanged -= ControlValuesChanged); CurrentControls.ForEach(x => _brushControl.Controls.Remove(x)); CurrentControls.Clear(); CurrentBrush = brush; if (CurrentBrush == null) { return; } CurrentControls.AddRange(CurrentBrush.GetControls().Reverse()); for (var i = 0; i < CurrentControls.Count; i++) { var ctrl = CurrentControls[i]; ctrl.Dock = DockStyle.Top; ctrl.ValuesChanged += ControlValuesChanged; _brushControl.Controls.Add(ctrl); _brushControl.Controls.SetChildIndex(ctrl, i); } //_brushControl.MinimumSize = new Size(0, _brushControl.Controls.OfType<Control>().Sum(x => x.Height + 6)); OnValuesChanged(CurrentBrush); }
private static void UpdateSelectedBrush(IBrush brush) { CurrentControls.ForEach(x => x.ValuesChanged -= ControlValuesChanged); CurrentControls.ForEach(x => _brushControl.Controls.Remove(x)); CurrentControls.Clear(); CurrentBrush = brush; if (CurrentBrush == null) return; CurrentControls.AddRange(CurrentBrush.GetControls().Reverse()); for (var i = 0; i < CurrentControls.Count; i++) { var ctrl = CurrentControls[i]; ctrl.Dock = DockStyle.Top; ctrl.ValuesChanged += ControlValuesChanged; _brushControl.Controls.Add(ctrl); _brushControl.Controls.SetChildIndex(ctrl, i); } //_brushControl.MinimumSize = new Size(0, _brushControl.Controls.OfType<Control>().Sum(x => x.Height + 6)); OnValuesChanged(CurrentBrush); }
private static void UpdateSelectedBrush(IBrush brush) { CurrentControls.ForEach(x => x.ValuesChanged -= ControlValuesChanged); CurrentControls.ForEach(x => _brushControl.Controls.Remove(x)); CurrentControls.Clear(); CurrentBrush = brush; if (CurrentBrush == null) return; CurrentControls.AddRange(CurrentBrush.GetControls()); CurrentControls.ForEach(x => x.ValuesChanged += ControlValuesChanged); CurrentControls.ForEach(x => x.Width = _brushControl.Width); CurrentControls.ForEach(x => _brushControl.Controls.Add(x)); _brushControl.Height = _brushControl.Controls.OfType<Control>().Sum(x => x.Height + 6); OnValuesChanged(CurrentBrush); }