Example #1
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //Color color_default;
            //color_default = Color.FromArgb(23,32,32);
            current_figure = 0;

            Templates    = new List <CFigure>();
            figure_names = new List <string>();
            parameters   = new int[4];

            list       = new CFigureList();
            DrawingPen = new Pen(Color.FromArgb(0, 0, 0), 1);

            Drawing = new Bitmap(PictureBoxDrawField.Width, PictureBoxDrawField.Height);
            Canvas  = Graphics.FromImage(Drawing);

            //Canvas.DrawLine(DrawingPen,10,10,121,211);

            Templates.Add(CEllipse.CreateTemplate());
            figure_names.Add("       Эллипс");
            Templates.Add(CRectangle.CreateTemplate());
            figure_names.Add("Прямоугольник");
            Templates.Add(CLine.CreateTemplate());
            figure_names.Add("      Отрезок");

            labelType.Text = figure_names[0];
            //list.figures.Add( Templates[0].Create(5, color_default, parameters) );

            //list.AddEllipse(11,color_default,point,15,20);
            //list.AddRectangle(12,color_default,point,200,200);

            //int n = list.figures.Count;

            //CEllipse ellipse = new CEllipse(12,color_default,250,250,35,20);
            //ellipse.Draw(Canvas, DrawingPen);

            //list.figures[0] = ellipse;

            //CRectangle rectangle = new CRectangle(5, color_default, point, 132, 102);
            //rectangle.Draw(Canvas, DrawingPen);

            //CLine line = new CLine(33,color_default,12,12,144,144);
            //line.Draw(Canvas,DrawingPen);

            //list.Draw(Canvas, DrawingPen);

            //MessageBox.Show(n.ToString());

            PictureBoxDrawField.Image = Drawing;
        }
Example #2
0
        public static CRectangle CreateTemplate()
        {
            CRectangle temp = new CRectangle(0, Color.FromArgb(0, 0, 0), 0, 0, 0, 0);

            return(temp);
        }
Example #3
0
        public override CFigure Create(int pen_width, Color pen_color, int[] parameters)
        {
            CRectangle temp = new CRectangle(pen_width, pen_color, parameters[0], parameters[1], parameters[2], parameters[3]);

            return(temp);
        }