コード例 #1
0
ファイル: FormMain.cs プロジェクト: bunak2000/OOTPiSP
        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;
        }
コード例 #2
0
        public static CLine CreateTemplate()
        {
            CLine temp = new CLine(0, Color.FromArgb(0, 0, 0), 0, 0, 0, 0);

            return(temp);
        }
コード例 #3
0
        public override CFigure Create(int pen_width, Color pen_color, int[] parameters)
        {
            CLine temp = new CLine(pen_width, pen_color, parameters[0], parameters[1], parameters[2], parameters[3]);

            return(temp);
        }