コード例 #1
0
        private void buttonAddShape_Click(object sender, EventArgs e)
        {
            if (_selectedShape != null)
            {
                _selectedShape.Color = _rememberColor;
            }
            _selectedShape = null;
            var create = new FormCreateEdit();
            var shape  = new Shape();

            create.Shape = shape;
            if (create.ShowDialog() == DialogResult.OK)
            {
                shape = create.Shape;

                _shapes.Add(shape);
                _shapeToBeDrawn = shape;
            }
        }
コード例 #2
0
        private void buttonEditShape_Click(object sender, EventArgs e)
        {
            if (_selectedShape != null)
            {
                var edit  = new FormCreateEdit();
                var shape = _selectedShape;
                shape.Color = _rememberColor;
                edit.Shape  = shape;
                if (edit.ShowDialog() == DialogResult.OK)
                {
                    _shapes.Remove(_selectedShape);

                    shape          = edit.Shape;
                    shape.Location = _selectedShape.Location;
                    _shapes.Add(shape);
                    _selectedShape = null;
                }
                buttonEditShape.Visible   = false;
                buttonDeleteShape.Visible = false;
                buttonCalculate.Visible   = false;
            }
            Invalidate();
        }