示例#1
0
        private void CreateRandomShapes(uint n)
        {
            this.m_Shapes.Clear();
            for (int i = 0; i < n; i++)
            {
                switch (this.m_Random.Next(3))
                {
                case 0:
                    this.m_Shapes.Add(RectangleShape.CreateFromRandom(this.m_Random, this.m_MaxRectangleSize, this.drawingBoard.Size));
                    break;

                case 1:
                    this.m_Shapes.Add(EllipseShape.CreateFromRandom(this.m_Random, this.m_MaxEllipseSize, this.drawingBoard.Size));
                    break;

                case 2:
                    this.m_Shapes.Add(TriangleShape.CreateFromRandom(this.m_Random, this.m_MaxTriangleSize, this.drawingBoard.Size));
                    break;
                }
            }
            this.drawingBoard.Refresh();
            this.UpdateStatusBar();
            this.toolBar.Buttons[1].Enabled  = true;
            this.me_deleteRectangles.Enabled = true;
            this.toolBar.Buttons[4].Enabled  = true;
            this.me_deleteEllipses.Enabled   = true;
            this.toolBar.Buttons[7].Enabled  = true;
            this.me_deleteTriangles.Enabled  = true;
        }
示例#2
0
        private void CreateRandomTriangles(uint n)
        {
            Size drawingBoardSize = this.drawingBoard.Size;

            for (int i = 0; i < n; i++)
            {
                this.m_Shapes.Add(TriangleShape.CreateFromRandom(m_Random, this.m_MaxTriangleSize, this.drawingBoard.Size));
            }
            this.drawingBoard.Refresh();
            this.UpdateStatusBar();
            this.me_deleteTriangles.Enabled = true;
            this.toolBar.Buttons[7].Enabled = true;
        }