Esempio n. 1
0
        private void btnAddShape_Click(object sender, System.EventArgs e)
        {
            int   X, Y, Width;
            Color aColor;

            X      = Convert.ToInt32(txtXPos.Text);
            Y      = Convert.ToInt32(txtYPos.Text);
            Width  = Convert.ToInt32(txtWidth.Text);
            aColor = lblColor.BackColor;

            AnyShape aShape;

            if (rbSquare.Checked)
            {
                aShape = new AnySquare(X, Y, aColor, Width);
            }
            else
            {
                aShape = new AnyCircle(X, Y, aColor, Width);
            }
            myModel.AddShape(aShape);
        }
Esempio n. 2
0
        private void btnAddShape_Click(object sender, System.EventArgs e)
        {
            int X, Y, Width;
            Color aColor;
            X = Convert.ToInt32(txtXPos.Text);
            Y = Convert.ToInt32(txtYPos.Text);
            Width = Convert.ToInt32(txtWidth.Text);
            aColor = lblColor.BackColor;

            AnyShape aShape;
            if (rbSquare.Checked)
            {
                aShape = new AnySquare(X, Y, aColor, Width);
            }
            else
            {
                aShape = new AnyCircle(X, Y, aColor, Width);
            }
            myModel.AddShape(aShape);
        }