private void CreateBox(int i) { SizeBox sb = new SizeBox(); int x = 1; int y = 1; if (_orientation == Orientation.Horizontal) { x = (_boxSize.Width + 2) * i + 1; } else { y = (_boxSize.Height + 2) * i + 1; } sb.Bounds = new Rectangle(x, y, _boxSize.Width, _boxSize.Height); sb.BackColor = _boxBackColor; sb.SelectionColor = _boxSelectionColor; sb.RoundingRadius = _roundingRadius; if (i == 0) { if (_minSize != null) { sb.Size = _minSize.Copy(); } else { sb.Size = new Size2D(4, 4); } } else if (i == _numBoxes - 1) { if (_maxSize != null) { sb.Size = _maxSize.Copy(); } else { sb.Size = new Size2D(32, 32); } } else { if (_minSize != null && _maxSize != null) { // because of the elses, we know that the number must be greater than 2, and that the current item is not the min or max // Use squaring so that bigger sizes have larger differences between them. double cw = (_maxSize.Width - _minSize.Width) / (_numBoxes); double ch = (_maxSize.Height - _minSize.Height) / (_numBoxes); sb.Size = new Size2D(_minSize.Width + cw * i, _minSize.Height + ch * i); } else { sb.Size = new Size2D(16, 16); } } _boxes.Add(sb); }
private void Configure() { _boxes = new List <SizeBox>(); _numBoxes = 4; _minSize = new Size2D(4, 4); _maxSize = new Size2D(30, 30); _selectedSize = _minSize.Copy(); _boxSize = new Size(36, 36); _boxBackColor = SystemColors.Control; _boxSelectionColor = SystemColors.Highlight; _symbol = new SimpleSymbol(); _orientation = Orientation.Horizontal; _roundingRadius = 6; RefreshBoxes(); }
private void BtnApplyClick(object sender, EventArgs e) { _original.Size = _editValue.Copy(); OnApplyChanges(); }
private void Configure() { _boxes = new List<SizeBox>(); _numBoxes = 4; _minSize = new Size2D(4, 4); _maxSize = new Size2D(30, 30); _selectedSize = _minSize.Copy(); _boxSize = new Size(36, 36); _boxBackColor = SystemColors.Control; _boxSelectionColor = SystemColors.Highlight; _symbol = new SimpleSymbol(); _orientation = Orientation.Horizontal; _roundingRadius = 6; RefreshBoxes(); }