Beispiel #1
0
        private void AddFigure(PictureBox pBox, MouseButtons mButton)
        {
            Figure f = null;

            switch (pBox.Tag.ToString())
            {
            case "Point":
                f = new Dot(MainColor);
                break;

            case "Line":
                f = new Line(MainColor, true);
                break;

            case "Triangle":
                f = new Triangle(MainColor, true);
                break;

            case "HatchTriangle":
                f = new HatchTriangle(MainColor, true);
                break;

            case "EquilateralTriangle":
                f = new EquilateralTriangle(MainColor, true);
                break;

            case "RightTriangle":
                f = new RightTriangle(MainColor, true);
                break;

            case "Tetrahedron":
                f = new Tetrahedron(MainColor, true);
                break;

            default:
                break;
            }
            if (!ReferenceEquals(f, null))            //по непонятнымпричинам экземпляр класса не создался
            {
                Canvas.Add(f);
                RefreshListBoxLevels();
                lBoxLevels.SelectedIndex = Canvas.Count - 1;
                if (mButton == MouseButtons.Right)
                {
                    f.IsDraw  = false;
                    f.MyColor = SecondColor;
                }
            }
        }
Beispiel #2
0
        private void DesignButtons()
        {
            Figure point = new Dot(MainColor);

            ChangeImage(pBoxPoint, point);
            Figure line = new Line(MainColor);

            ChangeImage(pBoxLine, line);
            Figure triangle = new Triangle(MainColor, true);

            ChangeImage(pBoxTriangle, triangle);
            Figure hatch = new HatchTriangle(MainColor, true);

            ChangeImage(pBoxHatchTriangle, hatch);
            Figure equil = new EquilateralTriangle(MainColor, true);

            ChangeImage(pBoxEquilateralTriangle, equil);
            Figure right = new RightTriangle(MainColor, true);

            ChangeImage(pBoxRightTriangle, right);
            Figure tetra = new Tetrahedron(MainColor, true);

            ChangeImage(pBoxTetrahedron, tetra);
        }