private void saveToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = UI.CreateSaveFile(); if (saveFileDialog.ShowDialog() == DialogResult.OK) { ShapesBL.SerializeList(listShape, saveFileDialog.FileName); isSave = true; } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = UI.CreateOpenFile(); if (openFileDialog.ShowDialog() == DialogResult.OK) { listShapes.ClearSelected(); listColor.ClearSelected(); panel1.Refresh(); listShape = ShapesBL.DeserializeList(openFileDialog.FileName); foreach (var it in listShape) { grap.FillPolygon(new SolidBrush(it.Color), it.ToArray()); } } }
private void panel1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { pointX = e.X; pointY = e.Y; panel_Paint(this, null); } else if (e.Button == MouseButtons.Right) { if (isShapes) { listShape.Remove(shape); shape = ShapesBL.MoveToPoint(shape, new Point(e.X, e.Y)); listShape.Add(shape); shape = null; isShapes = false; listShapes.ClearSelected(); listColor.ClearSelected(); panel1.Refresh(); foreach (var it in listShape) { grap.FillPolygon(new SolidBrush(it.Color), it.ToArray()); } isSave = false; } else { shape = listShape.FirstOrDefault(p => Geometry.IsInPolygon(p.ToArray(), new Point(e.X, e.Y)) == true); if (shape != null) { isShapes = true; MessageBox.Show("Please select new position"); } } } }