Beispiel #1
0
        public Primitive(Primitive prim)
		{
			this.Height = prim.Height;
			this.Width = prim.Width;
			this.Location = prim.Location;
			this.Rectangle = prim.Rectangle;
			this.FillColor =  prim.FillColor;
            this.LineWidth = prim.LineWidth;
		}
Beispiel #2
0
 private void SizeMinusContextMenuMouseHover(object sender, EventArgs e)
 {
     dialogProcessor.Selection = dialogProcessor.ContainsPoint(rightClick);
     if (dialogProcessor.Selection != null)
     {
         hoverAlpha = alphaChannel;
         dialogProcessor.SetSingleAlphaChannel(40);
         hover = dialogProcessor.Selection.Clone();
         dialogProcessor.PrimitiveList.Add(hover);
         dialogProcessor.Selection = hover;
         dialogProcessor.SetSingleAlphaChannel(255);
         dialogProcessor.Scale(-1);
         ViewPort.Invalidate();
         ViewPort2.Invalidate();
         ViewPort3.Invalidate();
     }
 }
 public void PastePrimitive(Primitive copy)
 {
     Primitive prim = copy.Clone();
     prim.Location = new PointF(prim.Location.X - 10, prim.Location.Y - 10);
     if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
         PrimitiveList3.Add(prim);
     else
         PrimitiveList.Add(prim);
     selection = prim;
 }
        // ADD PRIMITIVES

        public void AddPoint(PointF location, Color color)
        {
            PointShape point = new PointShape(new Rectangle((int)location.X, (int)location.Y, 5, 5));
            point.FillColor = MainForm.GetRandomColor();

            if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
                PrimitiveList3.Add(point);
            else
                PrimitiveList.Add(point);
            selection = point;
        }
        public void AddRandomExamPrimitive(int width = 200, int height = 200)
        {
            Random rnd = new Random();
            int x = rnd.Next(5, 1100);
            int y = rnd.Next(5, 600);

            ExamPrimitive exam = new ExamPrimitive(new Rectangle(x, y, width, height));
            exam.FillColor = MainForm.GetRandomColor();
            exam.BorderColor = MainForm.GetRandomBorderColor();

            if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
                PrimitiveList3.Add(exam);
            else
                PrimitiveList.Add(exam);
            selection = exam;
        }
        public void AddPolygon(PointF[] points, Color color)
        {
            PolygonShape polygon = new PolygonShape(points, color);
            polygon.FillColor = MainForm.GetRandomColor();

            if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
                PrimitiveList3.Add(polygon);
            else
                PrimitiveList.Add(polygon);
            selection = polygon;
        }
        public void AddRandomEllipse(int width = 100, int height = 200)
        {
            Random rnd = new Random();
            int x = rnd.Next(5, 1500);
            int y = rnd.Next(5, 750);

            EllipseShape ellipse = new EllipseShape(new Rectangle(x, y, width, height));
            ellipse.FillColor = MainForm.GetRandomColor();
            ellipse.BorderColor = MainForm.GetRandomBorderColor();

            if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
                PrimitiveList3.Add(ellipse);
            else
                PrimitiveList.Add(ellipse);
            selection = ellipse;
        }
        public void AddRandomTriangle()
        {
            Random rnd = new Random();
            int x = rnd.Next(5, 1700);
            int y = rnd.Next(5, 900);

            PointF p1 = new PointF(x, y);
            PointF p2 = new PointF(x + 120, y + 120);
            PointF p3 = new PointF(x - 120, y + 120);

            TriangleShape triangle = new TriangleShape(p1, p2, p3);
            triangle.FillColor = MainForm.GetRandomColor();
            triangle.BorderColor = MainForm.GetRandomColor();

            if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
                PrimitiveList3.Add(triangle);
            else
                PrimitiveList.Add(triangle);
            selection = triangle;
        }
        public void AddRandomRectangle()
        {
            Random rnd = new Random();
            int x = rnd.Next(5, 1500);
            int y = rnd.Next(5, 750);

            RectangleShape rect = new RectangleShape(new Rectangle(x, y, 100, 200));
            rect.FillColor = MainForm.GetRandomColor();
            rect.BorderColor = MainForm.GetRandomBorderColor();

            if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
                PrimitiveList3.Add(rect);
            else
                PrimitiveList.Add(rect);
            selection = rect;
        }
 public void AddLine(PointF line1, PointF line2, Color color)
 {
     LineShape line = new LineShape(line1, line2, color);
     line.FillColor = MainForm.GetRandomColor();
     if (Program.form.TabControl.SelectedTab.Equals(Program.form.TabPage3))
         PrimitiveList3.Add(line);
     else
         PrimitiveList.Add(line);
     selection = line;
 }
 public virtual void DrawShape(Graphics grfx, Primitive prim)
 {
     prim.DrawSelf(grfx);
 }