private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13 && choice) { if (mousepoz.Count < 2) { MessageBox.Show("Enter >1 point!", "ERROR"); return; } Type[] args = new Type[1]; args[0] = typeof(Point[]); object[] par = new object[1]; List <Point> list = new List <Point>(); list = mousepoz.GetRange(0, mousepoz.Count); mousepoz.Clear(); par[0] = list.ToArray(); ConstructorInfo ci = type.GetConstructor(args); if (ci != null) { Shapes.Shapes shape = (Shapes.Shapes)ci.Invoke(par); Graphics g = this.CreateGraphics(); shape.draw(g); } } }
private void rectangleToolStripMenuItem_Click(object sender, EventArgs e) { points = new Point[2]; points[0].X = rand.Next(0, 150); points[0].Y = rand.Next(0, 150); points[1].X = rand.Next(150, 300); points[1].Y = rand.Next(150, 300); shape = new Rectangle.Rectangle(points); shape.draw(g); list.Add(shape); }
private void ellipseToolStripMenuItem_Click(object sender, EventArgs e) { int a,b; point.X = rand.Next(120, 170); point.Y = rand.Next(0, 300); a = rand.Next(2, 80); b = rand.Next(2, 80); shape = new Ellipse.Ellipse(point, a,b); shape.draw(g); list.Add(shape); }
private void ellipseToolStripMenuItem_Click(object sender, EventArgs e) { int a, b; point.X = rand.Next(120, 170); point.Y = rand.Next(0, 300); a = rand.Next(2, 80); b = rand.Next(2, 80); shape = new Ellipse.Ellipse(point, a, b); shape.draw(g); list.Add(shape); }
private void lineToolStripMenuItem_Click(object sender, EventArgs e) { points = new Point[2]; for (i = 0; i <= 1; i++) { points[i].X = rand.Next(0, 300); points[i].Y = rand.Next(0, 300); } shape = new Line.Line(points); shape.draw(g); list.Add(shape); }
public Scene() { SamplingQuality = 0; RenderDiffuse = true; RenderHighlights = true; RenderShadow = true; RenderReflection = true; RenderRefraction = true; Camera = new Camera(new Vector(0, 0, -5), new Vector(0, 0, 1)); Shapes = new Shapes.Shapes(); Lights = new Lights(); Background = new Background(new Vector(0.2, 0.2, .2), 0.2); }
private void pictureBox1_MouseClick(object sender, MouseEventArgs e) { int count; if (polygon) { if (i > 0) { if ((Math.Abs(e.X - cont.ElementAt(0).X) < 5) && (Math.Abs(e.Y - cont.ElementAt(0).Y) < 5)) { g.DrawLine(Pens.Red, cont.ElementAt(i - 1), cont.ElementAt(0)); polygon = false; points = new Point[cont.Count]; for (count = 0; count < cont.Count; count++) { points[count] = cont.ElementAt(count); } shape = new Polygon.Polygon(points); shape.draw(g); list.Add(shape); } else { point.X = e.X; point.Y = e.Y; g.DrawLine(Pens.Red, point, cont.ElementAt(i - 1)); cont.Add(point); } } else { point.X = e.X; point.Y = e.Y; cont.Add(point); } i++; } }