Esempio n. 1
0
        //the class PaintEventArgs provides data for the object event Paint
        private void panelDrawing_Paint(object sender, PaintEventArgs e)
        {
            // Fill before painting to have a lighter border
            // Rectangle
            if (this.radioButtonRectangle.Checked == true && myRectangle != null)
            {
                if (fill)
                {
                    myRectangle.Fill(e);
                }
                myRectangle.Draw(e);

                this.textBoxDisplay.Text = myRectangle.ToString();
            }
            // Square
            if (this.radioButtonSquare.Checked == true && mySquare != null)
            {
                if (fill)
                {
                    mySquare.Fill(e);
                }
                mySquare.Draw(e);

                this.textBoxDisplay.Text = mySquare.ToString();
            }
            // Circle
            if (this.radioButtonCircle.Checked == true && myCircle != null)
            {
                if (fill)
                {
                    myCircle.Fill(e);
                }
                myCircle.Draw(e);

                this.textBoxDisplay.Text = myCircle.ToString();
            }
            // Ellipse
            if (this.radioButtonEllipse.Checked == true && myEllipse != null)
            {
                if (fill)
                {
                    myEllipse.Fill(e);
                }
                myEllipse.Draw(e);

                this.textBoxDisplay.Text = myEllipse.ToString();
            }
        }