internal void Paste() { BinaryFormatter bf = new BinaryFormatter(); ms.Position = 0; List <Shape> pastedShapeList = new List <Shape>(); try { pastedShapeList = (List <Shape>)bf.Deserialize(ms); foreach (var item in pastedShapeList) { ShapeList.Add(item); } Clipboard.SetData("My Format", ms); } catch (IOException e) { MessageBox.Show("something happened"); } catch (SerializationException e) { MessageBox.Show("copy something so you can paste it"); } }
internal void Copy() { Shape shape = new Shape(); if (selection != null) { shape = selection; if (shape.ShapeType == "Rectangle") { shape = new RectangleShape(new Rectangle((int)shape.Location.X, (int)shape.Location.Y, (int)shape.Width, (int)shape.Height)); CopyHelp(shape); } if (shape.ShapeType == "Ellipse") { shape = new EllipseShape(new Rectangle((int)shape.Location.X, (int)shape.Location.Y, (int)shape.Width, (int)shape.Height)); CopyHelp(shape); } ShapeList.Add(shape); } }
public void GroupRemoveSelection() { if (Selection.Count < 1) { return; } try { foreach (Shape item in group.SubItems) { //ShapeList.Remove(item); //item.Selected = false; ShapeList.Remove(group); ShapeList.Add(item); } group.SubItems = new List <Shape>(); Selection = new List <Shape>(); } catch (NullReferenceException ex) { RemoveSelection(); ex.Message.ToString(); } }
public void CoppyShape() { if (Selection != null) { Node CopyItem = new Node(new RectangleF(0, 0, 0, 0), ""); foreach (Shape item in Selection) { switch (item.ShapeType()) { case "node": String weight = item.getWeight(); CopyItem = new Node(new Rectangle(Convert.ToInt32(item.Location.X + 4), Convert.ToInt32(item.Location.Y + 4), Convert.ToInt32(item.Width), Convert.ToInt32(item.Height)), weight); CopyItem.SetOpacity(item.OpacityLvl); CopyItem.FillColor = item.FillColor; String MyNodeName = "Copy of " + item.MyName; CopyItem.SetName(MyNodeName); MainForm.MyGraph.addNodeToMap(MyNodeName, CopyItem); break; default: break; } } ShapeList.Add(CopyItem); } }
internal void Paste() { if (Current != null) { try { if (isGroupActive && !isMultigroupActive) { GroupShape gs = (GroupShape)DeSerialize(); PointF p = gs.Location; TranslateTo(p); ShapeList.Add(gs); } else { Shape s = (Shape)DeSerialize(); PointF p = s.Location; s.Location = Current; TranslateTo(p); ShapeList.Add(s); } } catch (Exception e) { } } }
public void SpawnByPanel(List <Shape> shapePanel) { foreach (var item in shapePanel) { ShapeList.Add(item); } }
public void SelectAll() { Selection = new List <Shape>(ShapeList); foreach (Shape item in Selection) { ShapeList.Add(item); } }
public void AddCustomRectangle(int x, int y, Color col) { RectangleShape rect = new RectangleShape(new Rectangle(211, 100, x, y)); rect.FillColor = col; rect.BorderColor = Pens.Black; rect.ShapeType = "Rectangle"; ShapeList.Add(rect); }
internal void PasteItems(PointF mouseLocation) { foreach (var s in shapeCopies) { Shape copy = (Shape)s.Clone(); copy.Location = mouseLocation; copy.BorderColor = Color.Black; ShapeList.Add(copy); } }
public void AddRandomLine() { // Random rnd = new Random(); LineShape line = new LineShape(PointStart, PointEnd); line.BorderColor = ColorBorder; ShapeList.Add(line); }
public void addModelShape() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); ModelShape shape = new ModelShape(new RectangleF(x, y, 100, 100)); ShapeList.Add(shape); }
public void AddCustomEllipse(int x, int y, Color col) { EllipseShape elipse = new EllipseShape(new Rectangle(211, 100, x, y)); elipse.FillColor = col; elipse.BorderColor = Pens.Black; elipse.ShapeType = "Ellipse"; ShapeList.Add(elipse); }
public void addRandomDot() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); DotShape dot = new DotShape(new RectangleF(x, y, 20, 20)); ShapeList.Add(dot); }
/// <summary> /// Добавя примитив - правоъгълник на произволно място върху клиентската област. /// </summary> public void AddRandomRectangle() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); RectangleShape rect = new RectangleShape(new Rectangle(x, y, 100, 200)); rect.FillColor = Color.White; ShapeList.Add(rect); }
public void AddElipse() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); ElipseShape shape = new ElipseShape(new Rectangle(x, y, 100, 100)); shape.FillColor = Color.White; ShapeList.Add(shape); }
//------------------------------------------ // Select or Create //------------------------------------------ private void OnPanelMousePressed(object sender, MouseEventArgs e) { if (_drawing) { SearchForFigure(e.Location); _tl = e.Location; var figure = ShapeFactory.Create(_shapeName, _tl, _tl); if (figure != null) { _shapes.Add(figure); } _pressed = true; } else if (_shapes.Count() > 0) { Point point = e.Location; SearchForFigure(point); } }
public void addRandomSquare() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); SquareShape square = new SquareShape(new RectangleF(x, y, 50, 50)); ShapeList.Add(square); }
public void AddRandomFilledRectangle(Color fillColor) { GetRandomDimensions(out var location, out var size); var rect = new RectangleShape(location, size) { FillColor = fillColor, BorderColor = Color.Transparent, }; ShapeList.Add(rect); }
public void AddRandomFilledPolygon(Color fillColor, int points) { GetRandomDimensions(out var location, out var size); var triangle = new PolygonShape(location, size.Width, points) { FillColor = fillColor, BorderColor = Color.Transparent, }; ShapeList.Add(triangle); }
public void AddRandomFilledElipse(Color fillColor) { GetRandomDimensions(out var location, out var size); var ellipse = new EllipseShape(location, size) { FillColor = fillColor, BorderColor = Color.Transparent, }; ShapeList.Add(ellipse); }
public void AddRandomCircle() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); CircleShape circle = new CircleShape(new Rectangle(x, y, 200, 200)); circle.FillColor = Color.DarkCyan; circle.BorderColor = Color.LimeGreen; ShapeList.Add(circle); }
// added from me public void AddRandomSquare() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); SquareShape square = new SquareShape(new Rectangle(x, y, 200, 200)); square.FillColor = Color.Yellow; square.BorderColor = Color.Red; ShapeList.Add(square); }
public void AddRandomCircle() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); CircleShape elipse = new CircleShape(new Rectangle(x, y, 100, 100)); elipse.FillColor = Color.White; ShapeList.Add(elipse); }
public void AddRandomSquare() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); SquareShape square = new SquareShape(new Rectangle(x, y, 100, 100)); square.FillColor = Color.White; ShapeList.Add(square); }
public void AddRandomElipse() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); ElipseShape elip = new ElipseShape(new Rectangle(x, y, 200, 100)); elip.FillColor = Color.White; elip.BorderColor = Color.Blue; ShapeList.Add(elip); }
public void AddLine(PointF pt1, PointF pt2) { Line line = new Line(pt1, pt2); line.Outline = new RectangleF(line.path.GetBounds().X, line.path.GetBounds().Y, line.Width, line.Height); line.Opacity = 255; line.FillColor = Color.FromArgb(line.Opacity, 45, 134, 89); ShapeList.Add(line); Selection = line; updateSelected(); }
public void AddRandomEllipse() { Random rnd = new Random(); int x = rnd.Next(100, 500); int y = rnd.Next(100, 300); EllipseShape rect = new EllipseShape(new Rectangle(x, y, 50, 100)); rect.FillColor = Color.White; ShapeList.Add(rect); }
public void AddRandomX() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); XShape xShape = new XShape(new Rectangle(x, y, 200, 100)); xShape.BorderColor = Color.Black; ShapeList.Add(xShape); }
/// <summary> /// Добавя примитив - правоъгълник на произволно място върху клиентската област. /// </summary> public void AddRandomRectangle() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); RectangleShape rectangle = new RectangleShape(new Rectangle(x, y, 100, 200)); rectangle.FillColor = Color.DeepSkyBlue; rectangle.BorderColor = Color.Green; ShapeList.Add(rectangle); }
public void AddCircle(PointF pt1, PointF pt2) { Circle circle = new Circle(pt1, pt2); circle.Outline = new RectangleF(circle.path.GetBounds().X, circle.path.GetBounds().Y, circle.Width, circle.Height); circle.Opacity = 255; circle.FillColor = Color.FromArgb(circle.Opacity, 45, 134, 89); ShapeList.Add(circle); Selection = circle; updateSelected(); }